<template>
     <view>
         <uni-nav-bar left-icon="left" :statusBar="true" titleSize="30px" leftText="返回" rightText="操作" title="租赁订单详情"
             @clickLeft="back" @clickRight="toeditFn" :fixed="true" backgroundColor="#3286ed" color="#fff">
         </uni-nav-bar>
         <view class="orderdetails">
             <view class="details">
                 <view class="list-header">
                     <view>{{list.orderNo}}</view>
                     <span>{{list.receivedAmount}}</span>
                 </view>
                 <view class="list-information">
                     <view>客户名称:<span>{{list.customerName}}</span></view>
                     <view>业务员:<span>{{list.salesmanName}}</span></view>
                     <view>订单发起日期:<span>{{list.orderDate}}</span></view>
                     
                 </view>
             </view>
			 <view style="width: 100%;height: 250px;margin-bottom: 10px;background-color: #fff;">
			 	<u-cell title="审批进度"></u-cell>
			 	<u-steps :current="parseFloat(active)-1"   direction="row" style='margin-left: 10px;margin-top: 20px;' >
			 			<u-steps-item v-for="item in ApprovalList" :title="item.approverName" :desc="item.remark">
			 				<!-- <text class="slot-icon" slot="icon">{{item.approverName.substr(0,1)}}</text> -->
			 			</u-steps-item>
			 	</u-steps>
				<view style="padding-left: 15px;">
					抄送人：
				</view>
				<view  style="padding-left: 15px;margin-top: 10px;display: flex;">
					<view v-for="item in copylist" style="position: relative; padding-right: 10px;">
						<u-avatar  name="nan" :text="item.copyerName.substr(0,1)" fontSize="18" ></u-avatar>
						 <u-icon v-if="item.copyerStatus==='1'" color="#13ce66" name="checkmark-circle-fill" style="position: absolute;top: 0;right: 5px"></u-icon>
					</view>
					
				</view>
			 	 <view v-if="buttonShow"   class="" style="width: 60%;padding-top: 20px; margin: 0 auto;  display:flex">
			 	 	     <u-button   :plain="true" :hairline="true"  type="success" style="margin-right: 5px;background-color: #13ce66;color: #fff;width: 95px;height: 30px;" @click="btnOk">同意</u-button>
			 	 	     <u-button :plain="true" :hairline="true"  type="success" @click="btnRe" style="background-color: red;color: #fff;width: 95px;height: 30px;">拒绝</u-button>
			 	 </view>
			 </view>
			 <!-- 同意 -->
			 <u-popup :show="showAgree" mode="center"  customStyle="width:80%">
			 	
			 	<u-cell style="margin:5px">
			 		<template #title>
			 		    <view class="titcolor" style="font-size: 20px;color: ;">审批意见</view>
			 		</template>
			 	</u-cell>
			            <view  style="margin:20px">
			               <u--textarea placeholder="请填审批意见~" v-model="approvalForm.remark"></u--textarea> 
			            </view>
			 		   <view class="button" style="width: 94%; display: flex;margin: 0px 10px auto;padding-bottom: 15px;padding-left: 4px;">
			 		   	<u-button   :hairline="true"    style="width: 130px;height: 35px;" @click="showAgree=false">取消</u-button>
			 			<u-button   :hairline="true"  type="success" style="width: 130px;height: 35px;" @click="approverFn">确认</u-button>
			 		   </view>
			 		   
			 </u-popup>
			 <!-- 驳回去驳回 -->
			 <u-popup :show="showRefouse" mode="center"  customStyle="width:80%">
			 	
			 	<u-cell style="margin:5px" >
			 		<template #title>
			 		    <view class="titcolor" style="font-size: 20px;color: ;">审批意见</view>
			 		</template>
			 	</u-cell>
			            <view  style="margin:5px">
			               <u--textarea placeholder="请填审批意见~" v-model="approvalForm.remark"></u--textarea> 
			            </view>
			 		   <view class="button" style="width: 100%; display: flex;">
			 		   	<u-button   :hairline="true"    style="margin: 4px;" @click="showRefouse=false">取消</u-button>
			 			<u-button   :hairline="true"  type="success" style="margin: 3px;" @click="approverReFn">确认</u-button>
			 		   </view>
			 		   
			 </u-popup>
             <view class="list-name">
                 <view>
                     <uni-icons type="calendar" style="font-size: 14px;margin-right: 10px;"></uni-icons>
                     {{list.customerName}}
                 </view>
                 <uni-icons type="right" style="font-size: 14px;"></uni-icons>
             </view>
             <uni-row class="demo-uni-row" style='border: solid 1px #eee;'>
                 <uni-col :span="12">
                     <view style="height:40px;line-height: 40px;border-right: solid 1px #eee;">
                         <uni-icons type="calendar" style="font-size: 14px;margin-right: 10px;"></uni-icons>
                         {{list.salesmanName}}
                     </view>
                 </uni-col>
                 <uni-col :span="12">
                     <view style="height:40px;line-height: 40px;">
                         <uni-icons type="calendar" style="font-size: 14px;margin-left: 10px;"></uni-icons>
                         签约
                     </view>
                 </uni-col>
             </uni-row>
         </view>
         <view class="orderdetails">
             <view style="margin: 10px 0 0 10px; height:40px;line-height: 40px;">
                 <uni-icons type="calendar" style="font-size: 14px;margin-right: 10px;"></uni-icons>
                 金额信息
             </view>

             <uni-grid :column="3" :show-border="false" :square="true">
                 <uni-grid-item>
                     <view class="grid-item-box">
                         <text class="text">{{list.depositReceivable}}.00元</text>
                         <text class="text">应收押金/元</text>
                     </view>
                 </uni-grid-item>
                 <uni-grid-item>
                     <view class="grid-item-box">
                         <text class="text">{{list.receivables}}.00元</text>
                         <text class="text">应收款/元</text>
                     </view>
                 </uni-grid-item>
                 <uni-grid-item>
                     <view class="grid-item-box">
                         <text class="text">{{list.receivedAmount}}.00元</text>
                         <text class="text">已收款金额/元</text>
                     </view>
                 </uni-grid-item>
                 <uni-grid-item>
                     <view class="grid-item-box">
                         <text class="text">{{list.unreceivedAmount}}.00元</text>
                         <text class="text">未收款金额/元</text>
                     </view>
                 </uni-grid-item>
                 <uni-grid-item>
                     <view class="grid-item-box">
                         <text class="text">{{list.badDebtAmount}}.00元</text>
                         <text class="text">坏账金额/元</text>
                     </view>
                 </uni-grid-item>
             </uni-grid>
         </view>
         <!-- tab栏信息 -->
         <u-tabs class="tabNav orderdetails" :current="index" style='margin-top: 10px;' @change="changeFn"
             lineWidth="104rpx" lineColor="#49b2f1" :activeStyle="{ color:'#49b2f1',fontWeight:'bold' }"
             :list="tabTitle"></u-tabs>

         <u--form labelPosition="left" class='orderdetails' labelWidth="200rpx" ref="form1">
             <!-- tab内容 -->
             <view class="box" v-if="index*1===0">
                 <u-cell>
                     <template #title>
                         <view class="u-cell-text" style="color: #49b2f1;">基本信息</view>
                     </template>
                 </u-cell>
                 <u-cell-group>
                     <u-cell>
                         <view slot="title">
                             <text class="u-cell-text">发起人:</text>
                             <text class="u-cell-text" style="margin-left: 10px;font-size: 17px;padding-left: 15px;">{{list.sponsorName}}</text>
                         </view>
                     </u-cell>
                     <u-cell>
                         <view slot="title">
                             <text class="u-cell-text">业务员:</text>
                             <text class="u-cell-text" style="margin-left: 10px;font-size: 17px;padding-left: 15px;">{{list.salesmanName}}</text>
                         </view>
                     </u-cell>
                     <u-cell>
                         <view slot="title">
                             <text class="u-cell-text">协同人:</text>
                             <text class="u-cell-text" style="margin-left: 10px;font-size: 17px;padding-left: 15px;">{{list.collaboratorName}}</text>
                         </view>
                     </u-cell>
                    
                     <u-cell>
                         <view slot="title">
                             <text class="u-cell-text">发起人所属部门:</text>
                             <text class="u-cell-text" style="margin-left: 10px;font-size: 17px;padding-left: 15px;">{{list.sponsorDeptName}}</text>
                         </view>
                     </u-cell>
                     <u-cell>
                         <view slot="title">
                             <text class="u-cell-text">订单编号:</text>
                             <text class="u-cell-text" style="margin-left: 10px;font-size: 17px;padding-left: 15px;">{{list.orderNo}}</text>
                         </view>
                     </u-cell>
                     <u-cell>
                         <view slot="title">
                             <text class="u-cell-text">订单发起日期:</text>
                             <text class="u-cell-text" style="margin-left: 10px;font-size: 17px;padding-left: 15px;">{{list.orderDate}}</text>
                         </view>
                     </u-cell>
                     <u-cell>
                         <view slot="title">
                             <text class="u-cell-text">业务所属公司:</text>
                             <text class="u-cell-text" style="margin-left: 10px;font-size: 17px;padding-left: 15px;">{{businessCompany}}</text>
                         </view>
                     </u-cell>
                     <u-cell>
                         <view slot="title">
                             <text class="u-cell-text">订单类型:</text>
                             <text class="u-cell-text" style="margin-left: 10px;font-size: 17px;padding-left: 15px;" v-if="list.orderType==1">新单</text>
                             <text class="u-cell-text" style="margin-left: 10px;font-size: 17px;padding-left: 15px;" v-if="list.orderType==2">补货</text>
                             <text class="u-cell-text" style="margin-left: 10px;font-size: 17px;padding-left: 15px;" v-if="list.orderType==3">换货</text>
                         </view>
                     </u-cell>
                     <u-cell>
                         <view slot="title">
                             <text class="u-cell-text">客户名称:</text>
                             <text class="u-cell-text" style=" margin-left: 10px;font-size: 17px;padding-left: 10px;">{{list.customerName}}</text>
                         </view>
                     </u-cell>
                     <u-cell>
                         <view slot="title">
                             <text class="u-cell-text">客户类别:</text>
                             <text class="u-cell-text" style="margin-left: 10px;font-size: 17px;padding-left: 15px;">{{customerCategory}}</text>
                         </view>
                     </u-cell>
                     <u-cell>
                         <view slot="title">
                             <text class="u-cell-text">客户信息来源:</text>
                             <text class="u-cell-text" style="margin-left: 10px;font-size: 17px;padding-left: 15px;">{{customerSource}}</text>
                         </view>
                     </u-cell>
                     <u-cell>
                         <view slot="title">
                             <text class="u-cell-text">客户所属省份:</text>
                             <text class="u-cell-text" style="margin-left: 10px;font-size: 17px;padding-left: 15px;">{{list.customerRegion}}</text>
                         </view>
                     </u-cell>
                     <u-cell>
                         <view slot="title">
                             <text class="u-cell-text">项目名称:</text>
                             <text class="u-cell-text" style="margin-left: 10px;font-size: 17px;padding-left: 15px;">{{list.projectName}}</text>
                         </view>
                     </u-cell>
                     <u-cell>
                         <view slot="title">
                             <text class="u-cell-text">项目地区域:</text>
                             <text class="u-cell-text" style="margin-left: 10px;font-size: 17px;padding-left: 15px;">{{list.projectArea}}</text>
                         </view>
                     </u-cell>
                     <u-cell>
                         <view slot="title">
                             <text class="u-cell-text">项目信息来源:</text>
                             <text class="u-cell-text" style="margin-left: 10px;font-size: 17px;padding-left: 15px;">{{projectSource}}</text>
                         </view>
                     </u-cell>
                     <u-cell>
                         <view slot="title">
                             <text class="u-cell-text">租赁形式:</text>
                             <text class="u-cell-text" style="margin-left: 10px;font-size: 17px;padding-left: 15px;">{{lease}}</text>
                         </view>
                     </u-cell>
                     <u-cell>
                         <view slot="title">
                             <text class="u-cell-text">收货地址:</text>
                             <text class="u-cell-text" style="margin-left: 10px;font-size: 17px;padding-left: 15px;">{{list.address}}</text>
                         </view>
                     </u-cell>
                     <u-cell>
                         <view slot="title">
                             <text class="u-cell-text">发货仓库:</text>
                             <text class="u-cell-text" style="margin-left: 10px;font-size: 17px;padding-left: 15px;">{{list.deliveryWarehouseName}}</text>
                         </view>
                     </u-cell>
                     <u-cell>
                         <view slot="title">
                             <text class="u-cell-text">辅料说明:</text>
                             <text class="u-cell-text" style="margin-left: 10px;font-size: 17px;padding-left: 15px;">{{list.accessoriesInstruction}}</text>
                         </view>
                     </u-cell>
                     <u-cell>
                         <view slot="title">
                             <text class="u-cell-text">日租金合计:</text>
                             <text class="u-cell-text" style="margin-left: 10px;font-size: 17px;padding-left: 15px;">{{list.totalDailyRent}}</text>
                         </view>
                     </u-cell>
                     <u-cell>
                         <view slot="title">
                             <text class="u-cell-text">应收押金(元):</text>
                             <text class="u-cell-text" style="margin-left: 10px;font-size: 17px;padding-left: 15px;">{{list.depositReceivable}}</text>
                         </view>
                     </u-cell>
                      <u-cell>
                          <view slot="title">
                              <text class="u-cell-text">实收押金(元):</text>
                              <text class="u-cell-text" style="margin-left: 10px;font-size: 17px;padding-left: 15px;">{{list.receivedAmount}}</text>
                          </view>
                      </u-cell>
                     
                     <u-cell>
                         <view slot="title">
                             <text class="u-cell-text">情况说明:</text>
                             <text class="u-cell-text" style="margin-left: 10px;font-size: 17px;padding-left: 15px;">{{list.description}}</text>
                         </view>
                     </u-cell>
                     
                     <u-cell>
                         <view slot="title">
                             <text class="u-cell-text">业务费情况:</text>
                             <text class="u-cell-text" style="margin-left: 10px;font-size: 17px;padding-left: 15px;">{{list.businessExpenses}}</text>
                         </view>
                     </u-cell>
                     <u-cell>
                         <view slot="title">
                             <text class="u-cell-text">期望到货日期:</text>
                             <text class="u-cell-text" style="margin-left: 10px;font-size: 17px;padding-left: 15px;">{{list.expectedArrivalDate}}</text>
                         </view>
                     </u-cell>
                     
                     <u-cell>
                         <view slot="title">
                             <text class="u-cell-text">运输方式:</text>
                             <text class="u-cell-text" style="margin-left: 10px;font-size: 17px;padding-left: 15px;">{{shippingType}}</text>
                         </view>
                     </u-cell>
					 <u-cell>
					     <template #title>
					         <view class="u-cell-text" style="color: #49b2f1;">物流信息</view>
					     </template>
					 </u-cell>
					 <view v-for="(item,index) in logisclist">
						 <view style="color: #49b2f1;padding-left: 8px;">物流信息{{index+1}}</view>
						 <u-cell>
						     <view slot="title">
						         <text class="u-cell-text">物流信息填写人:</text>
						         <text class="u-cell-text" style="margin-left: 10px;font-size: 17px;padding-left: 15px;">{{item.createBy}}</text>
						     </view>
						 </u-cell>
						 <u-cell v-if="item.outboundNo">
						     <view slot="title">
						         <text  class="u-cell-text">出库单编号:</text>
						         <text class="u-cell-text" style="margin-left: 10px;font-size: 17px;padding-left: 15px;">{{item.outboundNo}}</text>
						     </view>
						 </u-cell>
						 <u-cell v-if="item.returnApplyNo">
						     <view slot="title">
						         <text class="u-cell-text">回货申请单:</text>
						         <text class="u-cell-text" style="margin-left: 10px;font-size: 17px;padding-left: 15px;">{{item.returnApplyNo}}</text>
						     </view>
						 </u-cell>
						 <u-cell>
						     <view slot="title">
						         <text class="u-cell-text">填写时间:</text>
						         <text class="u-cell-text" style="margin-left: 10px;font-size: 17px;padding-left: 15px;">{{item.createTime}}</text>
						     </view>
						 </u-cell>
						 <u-cell>
						     <view slot="title">
						         <text class="u-cell-text">客户名称:</text>
						         <text class="u-cell-text" style="margin-left: 10px;font-size: 17px;padding-left: 15px;">{{item.customerName}}</text>
						     </view>
						 </u-cell>
						 <u-cell>
						     <view slot="title">
						         <text class="u-cell-text">司机姓名:</text>
						         <text class="u-cell-text" style="margin-left: 10px;font-size: 17px;padding-left: 15px;">{{item.driverName}}</text>
						     </view>
						 </u-cell>
						 <u-cell>
						     <view slot="title">
						         <text class="u-cell-text">联系电话:</text>
						         <text class="u-cell-text" style="margin-left: 10px;font-size: 17px;padding-left: 15px;">{{item.driverTel}}</text>
						     </view>
						 </u-cell>
						 <u-cell>
						     <view slot="title">
						         <text class="u-cell-text">项目名:</text>
						         <text class="u-cell-text" style="margin-left: 10px;font-size: 17px;padding-left: 15px;">{{item.projectName}}</text>
						     </view>
						 </u-cell>
						 <u-cell>
						     <view slot="title">
						         <text class="u-cell-text">项目地址:</text>
						         <text class="u-cell-text" style="margin-left: 10px;font-size: 17px;padding-left: 15px;">{{item.projectAddress}}</text>
						     </view>
						 </u-cell>
						 <u-cell>
						     <view slot="title">
						         <text class="u-cell-text">到货时间:</text>
						         <text class="u-cell-text" style="margin-left: 10px;font-size: 17px;padding-left: 15px;">{{item.arrivalDate}}</text>
						     </view>
						 </u-cell>
						 <u-cell>
						     <view slot="title">
						         <text class="u-cell-text">物流费用:</text>
						         <text class="u-cell-text" style="margin-left: 10px;font-size: 17px;padding-left: 15px;">{{item.logisticsExpenses}}</text>
						     </view>
						 </u-cell>
					 </view>
					 
                 </u-cell-group>
                 <!-- 出库单 -->
                 <view
                     v-if="list.orderStatus==1||list.orderStatus==2||list.orderStatus==3||list.orderStatus==4||list.orderStatus==5||list.orderStatus==6||list.orderStatus==7||list.orderStatus==9||list.orderStatus==10">
                     <u-cell>
                         <template #title>
                             <view style="display: flex;justify-content: space-between;">
                                 <view style="color:#49b2f1">出库单</view>
                                 <view style="color:#49b2f1" v-if="Outform.orderStatus=='1'">待出库</view>
                                 <view style="color:#49b2f1" v-if="Outform.orderStatus=='2'">已出库</view>
                             </view>
                             <view class="">

                             </view>
                         </template>
                     </u-cell>
                     <u--form class="form" labelPosition="left" labelWidth="150px" :model="Outform" ref="form">
                         <u-form-item label="出库单编号" prop="outboundNo" borderBottom ref="item1">
                             <u--input disabled disabledColor="#fff" v-model="Outform.outboundNo" border="none"
                                 placeholder="出库单编号"></u--input>
                             <u-icon slot="right" name="arrow-right"></u-icon>
                         </u-form-item>
                         <!-- <u-form-item  label="出库时间" prop="outboundTime" borderBottom ref="item1">
									<u--input disabled disabledColor="#fff" v-model="Outform.outboundTime" border="none" placeholder="出库时间"></u--input>
									<u-icon   slot="right" name="arrow-right"></u-icon>
								</u-form-item> -->
                         <u-form-item label="出库仓库" prop="outboundWarehouseName" borderBottom ref="item1">
                             <u--input disabled disabledColor="#fff" v-model="Outform.outboundWarehouseName"
                                 border="none" placeholder="出库仓库"></u--input>
                             <u-icon slot="right" name="arrow-right"></u-icon>
                         </u-form-item>
                         <u-form-item label="订单关联产品" borderBottom ref="item1">
                             <u-icon slot="right" name="arrow-right"></u-icon>
                         </u-form-item>
                         <uni-table border stripe emptyText="暂无更多数据">
                             <!-- 表头行 -->
                             <uni-tr>
                                 <uni-th align="center" width="100px">产品名称</uni-th>
                                 <uni-th align="center" width="100px">型号</uni-th>
                                 <uni-th align="center" width="60px">数量</uni-th>
								  <uni-th align="center" width="60px">日租金</uni-th>
                                 <uni-th align="center" width="100px">出库数量</uni-th>
                                 <uni-th align="center" width="100px">未出库数量</uni-th>
                                 <uni-th align="center" width="100px">回货数量</uni-th>
                             </uni-tr>
                             <!-- 表格数据行 -->
                             <uni-tr v-for="item in productList" :key="item.id">
                                 <uni-td align="center">{{item.productName}}</uni-td>
                                 <uni-td align="center">{{item.model}}</uni-td>
                                 <uni-td align="center">{{item.quantity}}</uni-td>
								 <uni-td align="center">{{item.dailyRent}}</uni-td>
                                 <uni-td align="center">{{item.deliveryQuantity}}</uni-td>
                                 <uni-td align="center">{{item.undeliveryQuantity}}</uni-td>
                                 <uni-td align="center">{{item.returnQuantity}}</uni-td>
                             </uni-tr>
                         </uni-table>
                         <!-- 已出库产品 -->
                         <view v-for="(item,index) in  outProductListInfo" :key="index">
                          
                             <u-cell>
                                 <template #title>
                                     <view style="font-size: 12ppx;height: 16px;">
                                         出库编号：{{item.outboundNo}}
                                     </view>
                                 </template>
                             </u-cell>
                             <scroll-view class="scroll-view_H" scroll-x="true" scroll-left="120">
                                 <uni-table :border="true" stripe emptyText="暂无更多数据">
                                     <uni-tr>
                                        
                                         <!-- <uni-th align="center">产品编号</uni-th> -->
                                         <uni-th align="center">产品名称</uni-th>
                                         <uni-th align="center">型号</uni-th>
                                         <uni-th align="center" width="100">仓库</uni-th>
										 <uni-th align="center">产品到货日期</uni-th>
										 <uni-th align="center">回货申请日期</uni-th>
										  <uni-th align="center">日租金</uni-th>
										  <uni-th align="center" width="180">机器序列号</uni-th>
                                     </uni-tr>
                                     <uni-tr v-for="(item) in item.machineList" :key="item.id">
                                         <!-- <uni-td>{{item.productNo}}</uni-td> -->
                                         <uni-td>{{item.productName}}</uni-td>
                                         <uni-td>{{item.model}}</uni-td>
                                         <uni-td>{{item.warehouseName}}</uni-td>
										 <uni-td>{{item.logisticsTime}}</uni-td>
										 <uni-td>{{item.warehouseTime}}</uni-td>
										 <uni-td>{{item.dailyRent}}</uni-td>
										 <uni-td>{{item.machineSerialNumber}}</uni-td>
                                     </uni-tr>
                                 </uni-table>
                             </scroll-view>
                         </view>



                     </u--form>
                 </view>
                 <!-- 回库申请 -->
                 <view>
                     <u-cell>
                         <template #title>
                             <view style="height: 35px;">
                                 <u-button style="width:100px;height: 30px;margin-right: 1px;" size="mini"
                                     type="success" @click="openBack">回库申请</u-button>
                             </view>
                         </template>
                     </u-cell>
                     <view v-if="backIndex">

                         <u-cell>
                             <template #title>
                                 <view style="display: flex;justify-content: space-between;">
                                     <view style="color:#49b2f1">回库申请</view>
                                     <view style="color:#49b2f1" v-if="list.orderStatus=='9'">申请中</view>
                                     <view style="color:#49b2f1" v-if="list.orderStatus=='3'">已申请回货</view>
                                     <view style="color:#49b2f1" v-if="list.orderStatus=='10'">入库中</view>
								     <view style="color:#49b2f1" v-if="list.orderStatus=='4'">已入库</view>
								     <view style="color:#49b2f1" v-if="list.orderStatus=='5'">已对账</view>
								 </view>

                             </template>
                         </u-cell>
                         <u--form class="form" labelPosition="left" labelWidth="150px" :model="Backform" ref="form">
                             <u-form-item label="回货申请单编号" prop="returnApplyNo" borderBottom ref="item1">
                                 <u--input disabled disabledColor="#fff" v-model="Backform.returnApplyNo" border="none"
                                     placeholder="回货申请单编号"></u--input>
                                 <u-icon slot="right" name="arrow-right"></u-icon>
                             </u-form-item>
                           
                             <u-form-item label="回库产品" prop="productList" borderBottom ref="item1">

                             </u-form-item>
                             <u-cell>
                                 <template #title>
                                     <view style="height: 35px;">
                                         <u-button style="width:100px;height: 30px;margin-right: 1px;" size="mini"
                                             type="success" @click="addBackproductList">新增回货</u-button>
                                     </view>
                                 </template>
                             </u-cell>
                             <view style="margin-bottom: 30px;" class="box" v-for="(items,index) in Backform.childReturnApply">
                                 <u-cell>
                                     <template #title>
                                         <view style="font-size: 12ppx;height: 16px;">
											 
                                             子级回货申请：{{items.returnApplyNo}}
                                         </view>
                                     </template>
                                 </u-cell>
								 <u-cell>
								     <template #title>
								         <view style="font-size: 12ppx;height: 16px;">
								             装货日期：{{items.loadingDate}}
								         </view>
								     </template>
								 </u-cell>
								
								 	
								 
                                 <view class="boxTop">
                                     <view class="">产品名称</view>
                                     <view class="">型号</view>
                                     <view class="">数量</view>
                                   
                                 </view>
                                 <view  class="boxValue" v-for="(item,index) in items.productList" :key="index">
                                     <view class="">
                                         <u--input v-model="item.productName" type="text"></u--input>
                                     </view>
                                     <view class="">
                                         <u--input v-model="item.model" type="text"></u--input>
                                     </view>
                                     <view class="">
                                         <u--input @change='isQuantity(item,index,items)' type="text"
                                             v-model="item.returnQuantity"></u--input>
                                     </view>
                                 </view>
								 
								 <view v-if="index==backeditShow ? true:false">
									
								 	<u-button style="margin-top: 10px;padding: 20px;" type="primary" text="提交修改" @click="editbackform(items)"></u-button>
								 </view>
								 
                             </view>
                         </u--form>
                     </view>

                 </view>
				  <u-cell>
				      <template #title>
				          <view style="height: 35px;">
				              <u-button style="width:100px;height: 30px;margin-right: 1px;" size="mini" type="success"
				                  @click="openStatement">对账单</u-button>
				          </view>
				      </template>
				  </u-cell>
				 <u-cell>
				     <template #title>
				         <view style="display: flex;justify-content: space-between;">
				             <view style="color:#49b2f1">对账单附件</view>
				 
				         </view>
				 
				     </template>
				 </u-cell>
				 <view class="">
				 						  <view class="">
				 						  	项目设备全部回库后第10天，第13天分别提醒业务员与客户对账或结算，15天内业务员必须完成对账或结算。
				 							设置看板（订单对账结算预警）
				 						  </view>
				 						  <view class="">
				 						  	应收合计，实收押金，实际欠款
				 						  </view>
				 						  
				 	<u--input disabled disabledColor="#fff" v-model="statementForm.accountStatementAttachments"
				 	    border="none" placeholder="对账单附件"></u--input>
				 	<u-icon slot="right" name="arrow-right"></u-icon>
				 	<u-upload :fileList="fileList1" @afterRead="afterRead" @delete="deletePic" name="1" multiple
				 	    :maxCount="10"></u-upload>
				 </view>
                 <!-- 对账单 -->
                 <u-cell>
                     <template #title>
                         <view style="height: 35px;">
                             <u-button style="width:100px;height: 30px;margin-right: 1px;" size="mini" type="success"
                                 @click="openStatement">结算单</u-button>
                         </view>
                     </template>
                 </u-cell>
                 <view v-if="statementShow">
                      
                     <u-cell>
                         <template #title>
                             <view style="display: flex;justify-content: space-between;">
                                 <view style="color:#49b2f1">结算单</view>

                             </view>

                         </template>
                     </u-cell>
                     <!-- 对账表单 -->
                     <u--form class="form" labelPosition="left" labelWidth="150px" :model="statementForm" ref="form">
                         <u-form-item label="对账单编号" prop="number" borderBottom ref="item1">
                             <u--input disabled disabledColor="#fff" v-model="statementForm.number" border="none"
                                 placeholder="对账单编号"></u--input>
                             <u-icon slot="right" name="arrow-right"></u-icon>
                         </u-form-item>
						 <u-form-item label="申请时间" prop="applyDate" borderBottom ref="item1">
						     <u--input disabled disabledColor="#fff" v-model="statementForm.applyDate" border="none"
						         placeholder="申请时间"></u--input>
						     <u-icon slot="right" name="arrow-right"></u-icon>
						 </u-form-item>
						 <u-form-item label="客户名称" prop="customerName" borderBottom ref="item1">
						     <u--input disabled disabledColor="#fff" v-model="statementForm.customerName" border="none"
						         placeholder="客户名称"></u--input>
						     <u-icon slot="right" name="arrow-right"></u-icon>
						 </u-form-item>
						 <u-form-item label="项目名称" prop="projectName" borderBottom ref="item1">
						     <u--input disabled disabledColor="#fff" v-model="statementForm.projectName" border="none"
						         placeholder="项目名称"></u--input>
						     <u-icon slot="right" name="arrow-right"></u-icon>
						 </u-form-item>
						 <u-form-item label="关联其他订单" @click="openOrderFn"  borderBottom ref="item1">
						     <u--input disabled disabledColor="#fff"   border="none"
						         placeholder="关联其他订单"></u--input>
						     <u-icon slot="right" name="arrow-right"></u-icon>
						 </u-form-item>
						 <uni-table border stripe emptyText="暂无更多数据" >
						 	<!-- 表头行 -->
						 	<uni-tr>
						 		<uni-th align="center">序号</uni-th>
						 		<uni-th align="center">订单编号</uni-th>
								<!-- <uni-th align="center">客户名称</uni-th> -->
								<uni-th align="center">项目名称</uni-th>
								<!-- <uni-th align="center">项目地址</uni-th> -->
								<!-- <uni-th align="center">联系人</uni-th> -->
								<!-- <uni-th align="center">联系人电话</uni-th> -->
						 		<uni-th align="center">操作</uni-th>
						 	</uni-tr>
						 	<!-- 表格数据行 -->
						 	<uni-tr v-for="(item,index) in statementForm.statementOrderList">
						 		<uni-td align="center">{{index+1}}</uni-td>
						 		<uni-td align="center">{{item.orderNo}}</uni-td>
						 		<!-- <uni-td align="center">{{item.customerName}}</uni-td> -->
								<uni-td align="center">{{item.projectName}}</uni-td>
								<!-- <uni-td align="center">{{item.projectAddress}}</uni-td> -->
								<!-- <uni-td align="center">{{item.consigneeName}}</uni-td> -->
								<!-- <uni-td align="center">{{item.consigneeTel}}</uni-td> -->
								<uni-td align="center">
									<button type="text" @click="delOrderInfoFn(index)">删除</button>
								</uni-td>
						 	</uni-tr>
						 	 
						 
						 </uni-table>
                         <u-form-item label="日租金合计" prop="totalDailyRent" borderBottom ref="item1">
                             <u--input disabled disabledColor="#fff" v-model="statementForm.totalDailyRent"
                                 border="none" placeholder="日租金合计"></u--input>
                             <u-icon slot="right" name="arrow-right"></u-icon>
                         </u-form-item>
                        <!-- 应收租金 为机器到货时间-回货申请时间 X 日租金 -->
                         <!-- 租赁机器 -->
                         <u-form-item label="机器应收费用" prop="rentReceivable" borderBottom ref="item1">
                             <u--input disabled disabledColor="#fff" v-model="statementForm.rentReceivable"
                                 border="none" placeholder="机器应收费用"></u--input>
                             <u-icon slot="right" name="arrow-right"></u-icon>
                         </u-form-item>
                         <u-form-item label="对账单附件" prop="accountStatementAttachments" borderBottom ref="item1">
                             <u--input disabled disabledColor="#fff" v-model="statementForm.accountStatementAttachments"
                                 border="none" placeholder="对账单附件"></u--input>
                             <u-icon slot="right" name="arrow-right"></u-icon>
							 <u-upload :fileList="fileList1" @afterRead="afterRead" @delete="deletePic" name="1" multiple
							     :maxCount="10"></u-upload>
                         </u-form-item>
                         
                      
                         <u-cell customStyle="{'color':'red'}" title="租赁费用明细表(业务员填写)" @click="productListFn">
                            
							 <template #value>
								  <u-icon   slot="right" name="arrow-right"></u-icon>
							 </template>
                         </u-cell>
						  <uni-table border stripe emptyText="暂无更多数据">
							  <!-- 表头行 -->
							  <uni-tr>
							      <uni-th width="100px" align="center">型号</uni-th>
							      <uni-th width="120px" align="center">起租时间</uni-th>
							      <uni-th width="120px" align="center">截止时间</uni-th>
							      <uni-th width="60px" align="center">天数</uni-th>
							      <uni-th width="60px" align="center">数量</uni-th>
							      <uni-th width="80px" align="center">日租金</uni-th>
								  <uni-th width="100px" align="center">操作</uni-th>
							  </uni-tr>
							  <uni-tr v-for="(item,index) in statementExpensesList" :key="index">
							      <uni-td align="center">
									  {{item.model}}
								  </uni-td>
							      <uni-td align="center" >
							           <template slot-scope="scope">
										    <view @click="openDate(index,1)">
										   <u--input disabled v-model="item.startDate"></u--input>
									  		 </view>
									   </template>
							      </uni-td>
							      <uni-td align="center">
							           <template slot-scope="scope">
							           	<view @click="openDate(index,2)">
							           		<u--input disabled v-model="item.endDate"></u--input>
							           			</view>
							           </template>
							      </uni-td>
							      <uni-td align="center">{{item.days}}</uni-td>
							      <uni-td align="center">
									  <template slot-scope="scope">
										  <u--input @blur="sumMoney(index)" type="text" v-model="item.quantity"/>
									  </template>
								  </uni-td>
								  <uni-td align="center">
								  	<template slot-scope="scope">
								  	<u--input @blur="sumMoney(index)" type="text" v-model="item.dailyRent"/>
								  	</template>
								  </uni-td>
							      <uni-td  align="center">
							          <button type="warn" size="mini" @click="removeProduct(index)">删除</button>
							      </uni-td>
							  </uni-tr>
						  </uni-table>
							 <u-form-item label="机器租赁费合计"   borderBottom ref="item1">
							        <u--input disabled disabledColor="#fff" v-model="totalMachineExpense"
							            border="none" placeholder="机器租赁费合计"></u--input>
							        <u-icon slot="right" name="arrow-right"></u-icon>
							    </u-form-item>
								<u-form-item label="租金折让" prop="rentAllowanceAmount" borderBottom ref="item1">
								    <u--input   disabledColor="#fff" v-model="statementForm.rentAllowanceAmount" border="none"
								        placeholder="租金折让" @blur="rentMoneyFn"></u--input>
								    <u-icon slot="right" name="arrow-right"></u-icon>
								</u-form-item>
								<u-form-item v-if="statementForm.rentAllowanceAmount*1>0?true:false" label="折让说明" prop="rentAllowanceAmount" borderBottom ref="item1">
								    <u-textarea    disabledColor="#fff" v-model="statementForm.rentAllowanceDescription" border="none"
								        placeholder="折让说明" ></u-textarea>
								    <u-icon slot="right" name="arrow-right"></u-icon>
								</u-form-item>
						   <!-- 包干情况说明 -->
                         <u-cell title="收取客户其他费用明细(业务员填写)" @click="moneyBtn(1)" name="收取客户其他费用">
                             <template #value>
                                 <view>添加</view>
                                 <uni-icons type="forward" size="24" color="#c3c3c3"></uni-icons>
                             </template>
                         </u-cell>
                         <view>
                             <uni-table border stripe emptyText="暂无更多数据">
                                 <!-- 表头行 -->
                                 <uni-tr>
                                     <uni-th align="center">序号</uni-th>
                                     <uni-th align="center">费用类别</uni-th>
                                     <uni-th align="center">单位</uni-th>
                                     <uni-th align="center">数量</uni-th>
                                     <uni-th align="center">类别总金额</uni-th>
                                     <uni-th align="center">操作</uni-th>

                                 </uni-tr>
                                 <!-- 表格数据行 -->
                                 <uni-tr v-for="(item,index) in statementForm.otherExpensesList" :key="index">
                                     <uni-td align="center">{{index+1}}</uni-td>
                                     <uni-td align="center">
                                         <span v-if="item.expenseCategory==1">物流费</span>
                                         <span v-if="item.expenseCategory==2">维修费</span>
                                         <span v-if="item.expenseCategory==0">其他</span>
                                     </uni-td>
                                     <uni-td align="center">
                                         <span v-if="item.unit==0">其他</span>
                                         <span v-if="item.unit==1">台</span>
                                     </uni-td>
                                     <uni-td align="center">{{item.quantity}}</uni-td>
                                     <uni-td align="center">{{item.totalAmount}}</uni-td>
                                     <uni-td align="center">
                                         <button type="warn" size="mini" @click="delHandFn(index,1)">删除</button>
                                     </uni-td>
                                 </uni-tr>
                             </uni-table>
                         </view>

                         <u-cell title="其他费用合计">
                             <template #value>
                                 <view>{{statementForm.totalOtherExpenses}}</view>
                             </template>
                         </u-cell>
                         <u-cell title="项目应扣费用明细(业务员填写)" @click="moneyBtn(2)">
                             <template #value>
                                 <view>添加</view>
                                 <uni-icons type="forward" size="24" color="#c3c3c3"></uni-icons>
                             </template>
                         </u-cell>
                         <view>
                             <uni-table border stripe emptyText="暂无更多数据">
                                 <!-- 表头行 -->
                                 <uni-tr>
                                     <uni-th align="center">序号</uni-th>
                                     <uni-th align="center">费用类别</uni-th>
                                     <uni-th align="center">单位</uni-th>
                                     <uni-th align="center">金额</uni-th>
                                     <uni-th align="center">是否已支付</uni-th>
                                     <uni-th align="center">支付方</uni-th>
                                     <uni-th align="center">操作</uni-th>

                                 </uni-tr>
                                 <!-- 表格数据行 -->
                                 <uni-tr v-for="(item,index) in statementForm.deductibleExpensesList" :key="index">
                                     <uni-td align="center">{{index+1}}</uni-td>
                                     <uni-td align="center">
                                         <span v-if="item.expenseCategory==1">物流费</span>
                                         <span v-if="item.expenseCategory==2">维修费</span>
                                         <span v-if="item.expenseCategory==0">其他</span>
                                     </uni-td>
                                     <uni-td align="center">
                                         <span v-if="item.unit==0">其他</span>
                                         <span v-if="item.unit==1">台</span>
                                     </uni-td>
                                     <uni-td align="center">{{item.amount}}</uni-td>
                                     <uni-td align="center">{{item.hasPaid}}</uni-td>
                                     <uni-td align="center">{{item.payer}}</uni-td>
                                     <uni-td align="center">
                                         <button type="warn" size="mini" @click="delHandFn(index,2)">删除</button>
                                     </uni-td>
                                 </uni-tr>
                             </uni-table>
                         </view>
						
                         <u-cell title="应扣费用合计">
                             <template #value>
                                 <view>{{statementForm.totalDeductibleExpenses}}</view>
                             </template>
                         </u-cell>
						 <u-cell title="项目应扣工程费(系统自动统计)">
						    <template #value>
						        <view>添加</view>
						        <uni-icons type="forward" size="24" color="#c3c3c3"></uni-icons>
						    </template>
						 </u-cell>
						 <view>
						     <uni-table border stripe emptyText="暂无更多数据">
						         <!-- 表头行 -->
						         <uni-tr>
						             <uni-th align="center">序号</uni-th>
						             <uni-th align="center">费用类别</uni-th>
						              
						             <uni-th align="center">金额</uni-th>
						              
						             <uni-th align="center">操作</uni-th>
						 
						         </uni-tr>
						         <!-- 表格数据行 -->
						         <uni-tr v-for="(item,index) in statementForm.projectEngineerCostList" :key="index">
						             <uni-td align="center">{{index+1}}</uni-td>
						             <uni-td align="center">
						                 <span >工程部费用</span>
						             </uni-td>
						              
						             <uni-td align="center">{{item.totalAmount}}</uni-td>
						             
						             <uni-td align="center">
						                 <button type="warn" size="mini" @click="delHandFn(index,5)">删除</button>
						             </uni-td>
						         </uni-tr>
						     </uni-table>
						 </view>
						 <u-cell title="项目工程费用合计">
						     <template #value>
						         <view>{{statementForm.totalProjectEngineerCost}}</view>
						     </template>
						 </u-cell>
                         <u-cell title="物流辅料费用明细" @click="moneyBtn(3)">
                             <template #value>
                                 <view>添加</view>
                                 <uni-icons type="forward" size="24" color="#c3c3c3"></uni-icons>
                             </template>
                         </u-cell>
                         <view>
                             <uni-table border stripe emptyText="暂无更多数据">
                                 <!-- 表头行 -->
                                 <uni-tr>
                                     <uni-th align="center">序号</uni-th>
                                     <uni-th align="center">费用类别</uni-th>
                                     <uni-th align="center">数量</uni-th>
                                     <uni-th align="center">金额</uni-th>
                                     <uni-th align="center">型号</uni-th>
                                     <uni-th align="center">日期</uni-th>
                                     <uni-th align="center">支付方</uni-th>
                                     <uni-th align="center">操作</uni-th>
                                 </uni-tr>
                                 <!-- 表格数据行 -->
                                 <uni-tr v-for="(item,index) in statementForm.logisticsExpensesList" :key="index">
                                     <uni-td align="center">{{index+1}}</uni-td>
                                     <uni-td align="center">
                                         <span v-if="item.expenseCategory==1">物流费</span>
                                         <span v-if="item.expenseCategory==2">维修费</span>
                                         <span v-if="item.expenseCategory==0">其他</span>
                                     </uni-td>
                                     <uni-td align="center">{{item.quantity}}</uni-td>
                                     <uni-td align="center">{{item.amount}}</uni-td>
                                     <uni-td align="center">{{item.model}}</uni-td>
                                     <uni-td align="center">{{item.expenseDate}}</uni-td>
                                     <uni-td align="center">{{item.payer}}</uni-td>
                                     <uni-td align="center">
                                         <button type="warn" size="mini" @click="delHandFn(index,3)">删除</button>
                                     </uni-td>
                                 </uni-tr>
                             </uni-table>
                         </view>
                         <u-cell title="物流费用合计">
                             <template #value>
                                 <view>{{statementForm.totalLogisticsExpenses}}</view>
                             </template>
                         </u-cell>
                         <u-cell title="维修配件费用明细" @click="moneyBtn(4)">
                             <template #value>
                                 <view>添加</view>
                                 <uni-icons type="forward" size="24" color="#c3c3c3"></uni-icons>
                             </template>
                         </u-cell>
                         <view>
                             <uni-table border stripe emptyText="暂无更多数据">
                                 <!-- 表头行 -->
                                 <uni-tr>
                                     <uni-th align="center">序号</uni-th>
                                     <uni-th align="center">费用类别</uni-th>
                                     <uni-th align="center">单位</uni-th>
                                     <uni-th align="center">备注</uni-th>
                                     <uni-th align="center">金额</uni-th>
                                     <uni-th align="center">操作</uni-th>

                                 </uni-tr>
                                 <!-- 表格数据行 -->
                                 <uni-tr v-for="(item,index) in statementForm.maintenanceCostList" :key="index">
                                     <uni-td align="center">{{index+1}}</uni-td>
                                     <uni-td align="center">
                                         <span v-if="item.expenseCategory==1">物流费</span>
                                         <span v-if="item.expenseCategory==2">维修费</span>
                                         <span v-if="item.expenseCategory==0">其他</span>
                                     </uni-td>
                                     <uni-td align="center">
                                         <span v-if="item.unit==0">其他</span>
                                         <span v-if="item.unit==1">台</span>
                                     </uni-td>
                                     <uni-td align="center">{{item.remark}}</uni-td>
                                     <uni-td align="center">{{item.totalAmount}}</uni-td>
                                     <uni-td align="center">
                                         <button type="warn" size="mini" @click="delHandFn(index,4)">删除</button>
                                     </uni-td>
                                 </uni-tr>
                             </uni-table>
                         </view>
                         <u-cell title="维修费用合计">
                             <template #value>
                                 <view>{{statementForm.totalMaintenanceCost}}</view>
                             </template>
                         </u-cell>
						 
						 
						 <u-form-item label="实收押金" prop="depositPaid" borderBottom ref="item1">
						     <u--input disabled disabledColor="#fff" v-model="statementForm.depositPaid" border="none"
						         placeholder="实收押金"></u--input>
						     <u-icon slot="right" name="arrow-right"></u-icon>
						 </u-form-item>
						 <u-form-item v-if="parseFloat(statementForm.payAmount)>=parseFloat(statementForm.depositPaid)" label="未收金额" prop="refundableDeposit" borderBottom ref="item1">
						     <u--input   disabledColor="#fff" v-model="statementForm.uncollected" border="none"
						         placeholder="未收金额"></u--input>
						     <u-icon slot="right" name="arrow-right"></u-icon>
						 </u-form-item>
						 <u-form-item   label="应收合计" prop="refundableDeposit" borderBottom ref="item1">
						     <u--input   disabledColor="#fff" v-model="statementForm.payAmount" border="none"
						         placeholder="应收合计"></u--input>
						     <u-icon slot="right" name="arrow-right"></u-icon>
						 </u-form-item>
						 
						 <u-form-item v-if="parseFloat(statementForm.payAmount)<=parseFloat(statementForm.depositPaid)" label="应退押金" prop="refundableDeposit" borderBottom ref="item1">
						     <u--input disabled disabledColor="#fff" v-model="statementForm.refundableDeposit" border="none"
						         placeholder="应退押金"></u--input>
						     <u-icon slot="right" name="arrow-right"></u-icon>
						 </u-form-item>
						 <u-form-item v-if="parseFloat(statementForm.payAmount)<=parseFloat(statementForm.depositPaid)" label="退款账户名" prop="accountName" borderBottom ref="item1">
						     <u--input   disabledColor="#fff" v-model="statementForm.openingBank" border="none"
						         placeholder="退款账户名"></u--input>
						     <u-icon slot="right" name="arrow-right"></u-icon>
						 </u-form-item>
						 <u-form-item v-if="parseFloat(statementForm.payAmount)<=parseFloat(statementForm.depositPaid)" label="退款账号" prop="accountNumber" borderBottom ref="item1">
						     <u--input   disabledColor="#fff" v-model="statementForm.accountNumber" border="none"
						         placeholder="退款账户"></u--input>
						     <u-icon slot="right" name="arrow-right"></u-icon>
						 </u-form-item>
						 <u-form-item v-if="parseFloat(statementForm.payAmount)<=parseFloat(statementForm.depositPaid)" label="开户行名" prop="accountNumber" borderBottom ref="item1">
						     <u--input   disabledColor="#fff" v-model="statementForm.openingBankName" border="none"
						         placeholder="开户行"></u--input>
						     <u-icon slot="right" name="arrow-right"></u-icon>
						 </u-form-item>
						 <u-form-item label="账户信息附件" prop="accountAttachments" borderBottom ref="item1">
						     <u--input disabled disabledColor="#fff" v-model="statementForm.accountAttachments" border="none"
						         placeholder="账户信息附件"></u--input>
						     <u-icon slot="right" name="arrow-right"></u-icon>
							 <u-upload :fileList="fileList2" @afterRead="afterRead" @delete="deletePic" name="2" multiple
							     :maxCount="10"></u-upload>
						 </u-form-item>
						 <!-- 税率 -->
						 <u-form-item   label="税率" prop="taxRatio" borderBottom ref="item1">
						     <u--input   disabledColor="#fff" v-model="statementForm.taxRatio" border="none"
						         placeholder="税率" @change="sumtaxRatio"></u--input>
						     <u-icon @click="taxRatioShow=true" slot="right" name="arrow-right"></u-icon>
						 </u-form-item>
						 <u-form-item   label="税费" prop="taxAmount" borderBottom ref="item1">
						     <u--input :disabled="true"  disabledColor="#fff" v-model="statementForm.taxAmount" border="none"
						         placeholder="税费"></u--input>
						     <u-icon slot="right" name="arrow-right"></u-icon>
						 </u-form-item>
						 <u-form-item   label="项目毛利" prop="estimateProjectProfit" borderBottom ref="item1">
						     <u--input :disabled="true"  disabledColor="#fff" v-model="statementForm.estimateProjectProfit" border="none"
						         placeholder="项目毛利"></u--input>
						     <u-icon slot="right" name="arrow-right"></u-icon>
						 </u-form-item>
						
						 <u-form-item v-if="!['1','3','23','24','30'].includes(list.projectSource)"   label="合伙人分成比列" prop="partnerRatio" borderBottom ref="item1">
						     <u--input   disabledColor="#fff" v-model="statementForm.partnerRatio" border="none"
						         placeholder="合伙人分成比列" @blur="sumpartnerRatio"></u--input>
						     <u-icon @click="partnerRatioShow=true" slot="right" name="arrow-right"></u-icon>
						 </u-form-item>
						 <u-form-item v-if="!['1','3','23','24','30'].includes(list.projectSource)"  label="合伙人分成金额" prop="partnerAmount" borderBottom ref="item1">
						     <u--input :disabled="true"  disabledColor="#fff" v-model="statementForm.partnerAmount" border="none"
						         placeholder="合伙人分成金额"></u--input>
						     <u-icon  slot="right" name="arrow-right"></u-icon>
						 </u-form-item>
						 </u-form-item><u-form-item   label="项目剩余毛利" prop="residualProjectProfit" borderBottom ref="item1">
						     <u--input  :disabled="true" disabledColor="#fff" v-model="statementForm.residualProjectProfit" border="none"
						         placeholder="项目剩余毛利"></u--input>
						     <u-icon slot="right" name="arrow-right"></u-icon>
						 </u-form-item>
						 <u-form-item v-if="salesmanRatioShow"  label="业务员分成比例" prop="salesmanRatio" borderBottom ref="item1">
						     <u--input   disabledColor="#fff" v-model="statementForm.salesmanRatio" border="none"
						         placeholder="业务员分成比例" @change="sumsalesmanRatio"></u--input>
						     <u-icon @click="sealemanshow=true"  slot="right" name="arrow-right"></u-icon>
						 </u-form-item>
						 <u-form-item  v-if="salesmanRatioShow" label="业务员分成金额" prop="salesmanAmount" borderBottom ref="item1">
						     <u--input :disabled="true"  disabledColor="#fff" v-model="statementForm.salesmanAmount" border="none"
						         placeholder="业务员分成金额"></u--input>
						     <u-icon slot="right" name="arrow-right"></u-icon>
						 </u-form-item>
						 
                     </u--form>
                     <view style="width: 100%;padding: 10px 20px;">
                         <u-button v-if="statementForm.id?false:true" type="success" @click="statementBtnOk">提交对账单</u-button>
                      <u-button v-if="statementForm.id?true:false" type="success" @click="statementBtnOk">修改对账单</u-button>
					 </view>
                 </view>
				  
             </view>
             <view class="box" v-if="index*1===1">
                 <u-cell>
                     <template #title>
                         <view class="titcolor">关联产品</view>
                     </template>
                 </u-cell>
                 <view class="productList-box">
                     <uni-table border :stripe="true" emptyText="暂无更多数据">
                         <!-- 表头行 -->
                         <uni-tr>
                             <uni-th align="center">整机品名</uni-th>
                             <uni-th align="center">型号</uni-th>
                             <uni-th align="center">数量</uni-th>
                             <uni-th align="center">日租金</uni-th>
                             <uni-th align="center">每日租金小计</uni-th>
                             <uni-th align="center">出库数量</uni-th>
                             <uni-th align="center">未出库数量</uni-th>
                             <uni-th align="center">回货数量</uni-th>
                             <uni-th align="center">备注</uni-th>
                         </uni-tr>
                         <!-- 表格数据行 -->
                         <uni-tr v-for="(item) in productList" :key="item.id">
                             <uni-td align="center">{{item.productName}}</uni-td>
                             <uni-td align="center">{{item.model}}</uni-td>
                             <uni-td align="center">{{item.quantity}}</uni-td>
                             <uni-td align="center">{{item.dailyRent}}</uni-td>
                             <uni-td align="center">{{item.dailyTotalRent}}</uni-td>
                             <uni-td align="center">{{item.deliveryQuantity}}</uni-td>
                             <uni-td align="center">{{item.undeliveryQuantity}}</uni-td>
                             <uni-td align="center">{{item.returnQuantity}}</uni-td>
                             <uni-td align="center">{{item.remark}}</uni-td>
                         </uni-tr>
                     </uni-table>

                 </view>

             </view>
             <view class="box" v-if="index*1===2">
                 <u-cell>
                     <template #title>
                         <view class="titcolor">维修订单</view>
                     </template>
                 </u-cell>
                 <view class="productList-box">
                     <uni-table border :stripe="true" emptyText="暂无更多数据">
                         <!-- 表头行 -->
                         <uni-tr>
                             <uni-th align="center" width="150px">机器序列号</uni-th>
                             <uni-th align="center" width="150px">机器编码</uni-th>
                             <uni-th align="center" width="100px">型号</uni-th>
                             <uni-th align="center" width="100px">状态</uni-th>
                             <uni-th align="center" width="100px">操作</uni-th>


                         </uni-tr>
                         <!-- 表格数据行 -->
                         <uni-tr v-for="(item,index) in machinelist" :key="index">
                             <uni-td align="center">{{item.machineNo}}</uni-td>
                             <uni-td align="center">
                                 <view style="min-width: 100px;">{{item.model}}</view>
                             </uni-td>
                             <uni-td align="center">
                                 <view style="min-width: 100px;" v-if="item.status=='0'">正常</view>
                                 <view style="min-width: 100px;" v-if="item.status=='1'">维修中</view>
                                 <view style="min-width: 100px;" v-if="item.status=='2'">使用中</view>
                                 <view style="min-width: 100px;" v-if="item.status=='3'">未激活</view>
                             </uni-td>
                             <uni-td align="center">
                                 <view style="display: flex;">
                                     <view style="min-width:50px;color:#3c9cff;" @click="repairBtn(item)">报修</view>
                                     <view style="min-width:50px;color:#3c9cff;"
                                         @click="toInfo(item.machineNo,list.orderNo)">详情</view>
                                 </view>
                             </uni-td>

                         </uni-tr>
                     </uni-table>
                 </view>
             </view>
             <view class="box" v-if="index*1===3">
                 <u-cell>
                     <template #title>
                         <view class="titcolor">项目支出</view>
                         <view class="addBtn" @click="addBtn">+新增</view>
                     </template>
                 </u-cell>
                 <view class="productList-box">
                     <uni-table border :stripe="true" emptyText="暂无更多数据">
                         <!-- 表头行 -->
                         <uni-tr>
                             <uni-th align="center" width="100px">项目</uni-th>
                             <uni-th align="center" width="100px">金额</uni-th>
                             <uni-th align="center" width="100px">操作</uni-th>

                         </uni-tr>
                         <!-- 表格数据行 -->
                         <uni-tr v-for="(item,index) in moneyList" :key="index">
                             <uni-td align="center">{{item.projectName}}</uni-td>
                             <uni-td align="center">{{item.projectCost}} </uni-td>
                             <uni-td align="center">
                                 <view style="display: flex;margin-left: 40px;">
                                     <view style="min-width:25px;color:#3c9cff;margin-right: 5px;"
                                         @click="addBtn(item)">修改</view>
                                     <view style="min-width:25px;color:#3c9cff;" @click="delBtn(item)">删除</view>
                                 </view>
                             </uni-td>

                         </uni-tr>
                     </uni-table>
                 </view>
             </view>
             <view class="box" v-if="index*1===4">
                 <u-cell>
                     <template #title>
                         <view class="titcolor">审批记录</view>
                     </template>
                 </u-cell>
                 <view class="productList-box">
                     <uni-table border :stripe="true" emptyText="暂无更多数据">
                         <!-- 表头行 -->
                         <uni-tr>
                             <uni-th align="center">序号</uni-th>
                             <uni-th align="center">订单编号</uni-th>
                             <uni-th align="center">申请人</uni-th>
                             <uni-th align="center">审批人</uni-th>
							 <uni-th align="center">状态</uni-th>
							 
                         </uni-tr>

                         <uni-tr v-for="(item,index) in ApprovalList" :key="item.id">
                             <uni-td align="center">{{index}}</uni-td>
                             <uni-td align="center">{{item.serialNum}}</uni-td>
                             <uni-td align="center">{{item.userName}}</uni-td>
                             <uni-td align="center">{{item.approverName}}</uni-td>
							 <uni-td align="center">{{item.approvalStatus}}</uni-td>
							  
                         </uni-tr>
                     </uni-table>
                 </view>
             </view>
             <view class="box" v-if="index*1===5">
                 <u-cell>
                     <template #title>
                         <view class="titcolor">电子合同</view>
                     </template>
                 </u-cell>
                 <view class="agreement">
                     <iframe style="width: 100%; height:500px" :src="`http://101.132.141.5:8081${list.agreement}`"
                         frameborder="0"></iframe>
                 </view>
             </view>
             <view class="box" v-if="index*1===6">
                 <u-cell>
                     <template #title>
                         <view class="titcolor">转账凭证</view>
                     </template>
                 </u-cell>
                 <view class="agreement" @click="photoFn">
                     <a :href="`http://101.132.141.5:8081${list.enclosure}`">
                         <u--image :showLoading="true" :src="`http://101.132.141.5:8081${list.enclosure}`" width="80px"
                             height="80px"></u--image>
                     </a>

                 </view>
             </view>

         </u--form>
         <!-- 项目支出弹框 -->
         <u-popup :closeable="true" :show="show" mode="center">
             <view class="pop-box">
                 <view style="display:flex;margin-bottom: 10px;">
                     <view class="title">费用名称</view>
                     <u--input placeholder="请输入费用名称" v-model="formData.projectName" border="surround"></u--input>
                 </view>
                 <view style="display:flex;">
                     <view class="title">金额</view>
                     <u--input placeholder="请输入金额" v-model="formData.projectCost" border="surround"></u--input>
                 </view>
                 <view class="button">
                     <u-button customStyle="width:30px;margin-right:5px;" @click="show=false" size="small" text="取消">
                     </u-button>
                     <u-button customStyle="width:30px" type="primary" @click="addMoneyBtn" size="small" text="确定">
                     </u-button>
                 </view>
             </view>

         </u-popup>
         <u-modal showConfirmButton showCancelButton @confirm="BtnModel" @cancel="BtnShow=false" width="250px"
             :show="BtnShow" title="提示">
             <view class="slot-content">
                 <rich-text nodes="是否确认审批通过?"></rich-text>
             </view>
         </u-modal>
         <u-modal showConfirmButton showCancelButton @confirm="BtnModel1" @cancel="BtnShow1=false" width="250px"
             :show="BtnShow1" title="提示">
             <view class="slot-content">
                 <rich-text nodes="是否确认审批通过?"></rich-text>
             </view>
         </u-modal>
         <!-- 提示消息 -->
         <u-toast ref="uToast"></u-toast>
         <!-- 右边弹框费用添加 -->
         <u-popup :show="moneyShow" mode="right" :closeOnClickOverlay="true" @close="moneyShow=false"
             overlayStyle="margin-top:88rpx;" customStyle="margin-top:88rpx;min-width:250px;">
             <view class="Box" v-if="type==1">
                 <u-cell title="费用类别" @click="expenseTypeShow=true">
                     <template #value>
                         <view>{{expenseType}}</view>
                         <view v-if="!expenseType" style="font-size: 14px;">请选择</view>
                     </template>
                 </u-cell>
                 <u-cell title="单位" @click="expenseUnitShow=true">
                     <template #value>
                         <view>{{unit}}</view>
                         <view v-if="!unit" style="font-size: 14px;">请选择</view>
                     </template>
                 </u-cell>
                 <view class="little-box">
                     <view class="title">数量:</view>
                     <u--input v-model="expensesForm.quantity" placeholder="请输入内容"></u--input>
                 </view>
                 <view class="little-box">
                     <view class="title">类别总金额:</view>
                     <u--input v-model="expensesForm.totalAmount" placeholder="请输入内容"></u--input>
                 </view>
             </view>
             <view class="Box" v-if="type==2">
                 <u-cell title="费用类别" @click="expenseTypeShow=true">
                     <template #value>
                         <view>{{expenseType}}</view>
                         <view v-if="!expenseType" style="font-size: 14px;">请选择</view>
                     </template>
                 </u-cell>
                 <u-cell title="单位" @click="expenseUnitShow=true">
                     <template #value>
                         <view>{{unit}}</view>
                         <view v-if="!unit" style="font-size: 14px;">请选择</view>
                     </template>
                 </u-cell>
                 <view class="little-box">
                     <view class="title">金额:</view>
                     <u--input v-model="expensesForm.amount" placeholder="请输入内容"></u--input>
                 </view>
                 <u-cell title="是否已支付" @click="payShow=true">
                     <template #value>
                         <view v-if="expensesForm.hasPaid=='0'">未支付</view>
                         <view v-if="expensesForm.hasPaid=='1'">已支付</view>
                         <view v-if="!expensesForm.hasPaid" style="font-size: 14px;">请选择</view>
                     </template>
                 </u-cell>

                 <view class="little-box">
                     <view class="title">支付方:</view>
                     <u--input v-model="expensesForm.payer" placeholder="请输入内容"></u--input>
                 </view>
             </view>
             <view class="Box" v-if="type==3">
                 <u-cell title="费用类别" @click="expenseTypeShow=true">
                     <template #value>
                         <view>{{expenseType}}</view>
                         <view v-if="!expenseType" style="font-size: 14px;">请选择</view>
                     </template>
                 </u-cell>
                 <view class="little-box">
                     <view class="title">数量:</view>
                     <u--input v-model="expensesForm.quantity" placeholder="请输入内容"></u--input>
                 </view>
                 <view class="little-box">
                     <view class="title">金额:</view>
                     <u--input v-model="expensesForm.amount" placeholder="请输入内容"></u--input>
                 </view>
                 <u-cell title="型号" @click="modelShow=true">
                     <template #value>
                         <view>{{expensesForm.model}}</view>
                         <view v-if="!expensesForm.model" style="font-size: 14px;">请选择</view>
                     </template>
                 </u-cell>
                 <u-cell title="日期" @click="dateBtn">
                     <template #value>
                         <view>{{expensesForm.expenseDate}}</view>
                         <view v-if="!expensesForm.expenseDate" style="font-size: 14px;">请选择</view>
                     </template>
                 </u-cell>
                 <view class="little-box">
                     <view class="title">支付方:</view>
                     <u--input v-model="expensesForm.payer" placeholder="请输入内容"></u--input>
                 </view>
                 <view>
                     <uni-datetime-picker ref="date" v-model="expensesForm.expenseDate" @change="changeFn" />
                 </view>

             </view>
             <view class="Box" v-if="type==4">
                 <u-cell title="费用类别" @click="expenseTypeShow=true">
                     <template #value>
                         <view>{{expenseType}}</view>
                         <view v-if="!expenseType" style="font-size: 14px;">请选择</view>
                     </template>
                 </u-cell>
                 <u-cell title="单位" @click="expenseUnitShow=true">
                     <template #value>
                         <view>{{unit}}</view>
                         <view v-if="!unit" style="font-size: 14px;">请选择</view>
                     </template>
                 </u-cell>
                 <view class="little-box">
                     <view class="title">数量:</view>
                     <u--input v-model="expensesForm.quantity" placeholder="请输入内容"></u--input>
                 </view>
                 <view class="little-box">
                     <view class="title">类别总金额:</view>
                     <u--input v-model="expensesForm.totalAmount" placeholder="请输入内容"></u--input>
                 </view>
             </view>
             <view class="btn">
                 <view @click="moneyShow=false">取消</view>
                 <view @click="submitBtn">确定</view>
             </view>
         </u-popup>
		 <!-- 关联项目选择框 -->
		 <u-popup :show="orderListShow" mode="right" :closeOnClickOverlay="true" @close="orderListShow=false"
		     overlayStyle="margin-top:88rpx;" customStyle="margin-top:88rpx;min-width:250px;">
			 <scroll-view  :scroll-y="true" class="scroll-Y" @scrolltolower="scrolltolower" >
			 						  <view class="right-list" v-for="item in OrderListInfo"  @click="checked(item)">
			 								<view>订单编号:{{item.orderNo}}</view>
			 								<view>客户名称:{{item.customerName}}</view>
											<view>项目名:{{item.projectName}}</view>
			 								<view>业务员:{{item.salesmanName}}</view>
			 								<view>订单创建时间:{{item.orderDate}}</view>
			 								<view class="button" >选择</view>
			 						  </view>
			 						  <!-- <view v-if="this.OrderListInfo.length==this.orderTotal  && this.OrderListInfo.length!==0">沒有更多了</view> -->
			 </scroll-view>
		</u-popup>
			 
	<u-datetime-picker :show="expectedArrivalDateShow"  v-model="dateNow" @confirm="expectedArrivalDateConfirm" @cancel="expectedArrivalDateShow=false" mode="date"  ></u-datetime-picker>
     <u-action-sheet :actions="expenseTypeOption" @close="expenseTypeShow=false" @select="selectBtn" title="费用类别" :show="expenseTypeShow"></u-action-sheet>
     <u-action-sheet :actions="expenseUnitOption" @close="expenseUnitShow=false" @select="selectBtn2" title="费用类别单位" :show="expenseUnitShow"></u-action-sheet>
     <!-- 是否已支付 -->
     <u-action-sheet :actions="isPay" @close="payShow=false" @select="selectBtn3" title="是否已支付" :show="payShow"></u-action-sheet>
     <!-- 型号 -->
     	<u-picker :closeOnClickOverlay="true"  @close="modelShow=false" :show="modelShow" @confirm="modelConfirm" :columns="modelOption" @cancel="modelShow=false"></u-picker>
     <!-- 税率选择器-->
	 <u-picker :closeOnClickOverlay="true" :show="taxRatioShow" :columns="taxRatiocolumns" @confirm="taxRatioConfirm" @cancel="taxRatioShow=false" keyName="dictLabel"></u-picker>
	<!-- 合伙人分成比例 -->
	<u-picker :closeOnClickOverlay="true" :show="partnerRatioShow" :columns="partnerRatiocolumns" @confirm="partnerRatioConfirm" @cancel="partnerRatioShow=false" keyName="dictLabel"></u-picker>
	<!-- 业务员分成比例 -->
	<u-picker :closeOnClickOverlay="true" :show="sealemanshow" :columns="sealemancolum" @confirm="sealemanConfirm" @cancel="sealemanshow=false" keyName="dictLabel"></u-picker>
	 </view>
 </template>

 <script>
     import { getLoginUser} from '@/api/system/user.js'
     import {getDicts} from '@/api/dictionary/index.js'
     import {getOrder,getMachineList,getMachineList2,updateOrderStatus,updateOrderStatus1,updateOrderStatus2,listOrder} from '@/api/order/order.js'
     import {getProjectExpendListApi,addProjectExpendApi,editProjectExpendApi,delProjectExpendApi,getProjectExpendApiInfoApi} from '@/api/reported.js'
     import { getApprovalInfo,getApprovalList, editApprovalInfo, addApproval } from '@/api/approval.js'
     import {listHouse,listHouse3,outOrderinfo,addOrderApi,editOrderApi,} from '@/api/out/out.js'
     import {addBackWarehouseApi,getBackWarehouseInfoApi,getChildNo, getBackWarehouseList, editBackWarehouseApi} from '@/api/backapplication.js';
     import {machineList} from '@/api/machine/machine.js'
     import {repairListApi} from '@/api/repair.js'
     import {getLogisticsListApi} from '@/api/logistics.js'
     import {addStatementApi, getMachineListExpenseApi,editStatementApi, getStatementListApi,} from '@/api/accountStatement.js'
     import {listCost} from '@/api/enginee.js'
	 import {getFinalStatementListApi,delFinalStatementApi,getFinalStatementInfoApi,addFinalStatementApi,editFinalStatementApi} from '@/api/finnalStatement.js'
     import { getToken} from '@/utils/auth.js'
	 import {getapprovalRecodeList,editapprovalRecode} from '@/api/approvaRecode.js'
	 import {getcopylist,editcopyapi} from '@/api/copy.js'
	 import {selectProductQuantityList} from '@/api/product/product.js'
	 import {machineRecodeList} from "@/api/machine/machine.js"
	 export default {
         data() {
             return {
				 headers: {
				     Authorization: "Bearer " + getToken(),
				 },
				 dateNow:'',//当前时间
				 expectedArrivalDateShow:false,
				 idx:0,
				 Num:0,
				 	fileList1:[],
					fileList2:[],
                 ApprovalList: [],
                 BtnShow: false,
                 BtnShow1: false,
                 user: {},
                 userId: '',
                 index: 0,
                 show: false, //控制项目支出
                 tabTitle: [{
                         name: '基本信息'
                     },
                     {
                         name: '关联产品',
                     },
                     {
                         name: '维修订单',
                     },
                     {
                         name: '项目支出'
                     },
                     {
                         name: '审批记录'
                     },
                     {
                         name: '电子合同'
                     },
                     {
                         name: '转账凭证'
                     }
                 ],
                 id: 0,
                 list: {}, //订单详情数据
				 logisclist:[],//物流信息列表
                 productList: [], //关联产品
                 machinelist: [], //订单关联的机器
                 formData: {
                     projectName: '',
                     projectCost: ''
                 },
                 moneyList: [],
                 customerOption: [], //客户类型
                 customerCategory: '', //客户类型显示
                 businessCompanyOption: [], //业务所属公司
                 businessCompany: '',
                 customerSourceOption: [],
                 customerSource: '',
                 projectSourceOption: [], //
                 projectSource: '',
                 depositCollectionMethodOption: [], //押金收取方式
                 depositCollectionMethod: '',
                 shippingTypeOption: [],
                 shippingType: '',
                 leaseOPtion: [],
                 lease: '',
                 permissions: [],
                 approvalShow: false,
                 approvalShow1: false,
				 approvalShow2: false,
                 // 出库单表单
                 Outform: {
                     parentId: '',
                     outboundNo: '',
                     outboundTime: '', //出库时间
                     sponsor: '', //发起人
                     sponsorName: '', //发起人名称
                     customerId: '',
                     customerName: '', //客户名称
                     orderType: '', //订单类型
                     orderId: '',
                     orderNo: '', //订单编号
                     outboundWarehouseId: '',
                     outboundWarehouseName: '', //仓库名称
                     totalDailyRent: '', //日租金合计
                     remark: '', //备注
                     machineList: [], //机器列表
                 },
				 backeditShow:null,
                 // 回货申请单
                 Backform: {
                     parentId: 0, //	是	Long	父级申请单id,第一次申请不传此属性或者传0
                     returnApplyNo: '', //	是	String	回货单编号
                     returnType: '1', //	是	String	回货/退货类型
                     returnTypeDou: '回货',
                     sponsor: '', //	是	Long	发起人
                     sponsorName: '', //	是	string	发起人名称
                     customerId: '', //	是	Long	客户
                     customerName: '', //	是	string	客户名称
                     orderId: '', //	是	Long	租赁销售订单
                     orderNo: '', //	是	string	订单编号
                     loadingAddressProvince: '', //	是	String	装货地址省份
                     loadingAddressCity: '', //	是	String	装货地址市
                     loadingAddressAre: '', //a	是	String	装货地址区
                     loadingAddress: '', //	是	String	装货地址详细信息
                     contactName: '', //	是	String	对接人名称
                     contactTelephone: '', //	是	String	联系电话
                     loadingDate: '', //	是	date	装货日期
                     whetherLogisticsRequired: '', //	是	Long	是否需要物流安排车辆
                     collaborator: '', //	是	string	协同人
                     collaboratorName: '', //	是	BigDecimal	协同人名称
                     remark: '', //	是	string	备注
                     totalDailyRent: '', //	是	string	日租金合计
                     shippingType: '', //	是	string	运输方式
                     driverName: '', //e	是	string	司机姓名
                     driverTel: '', //el	是	string	司机联系方式
                     vehicleInformation: '', //	是	string	车辆信息
                     warehouseId: '', //是	string	仓库id
                     warehouseName: '', //e	是
                     productList: [],
                     salesman: '',
                     salesmanName: '',
                 },
				 orderListShow:false,//关联订单选择框
				 OrderListInfo:[],//订单选择数据
                 //对账但表单
                 statementForm: {
                     contractTemplate: '', //	是	String	合同模板
                     sponsor: '', //	是	Long	发起人
                     sponsorName: '', //是	string	发起人名称
                     salesman: '', //	是	Long	业务员
                     salesmanName: '', //	是	string	业务员名称
                     applyDate: '', //	是	Date	申请日期
                     number: '', //	是	String	编号
                     customerId: '', //	是	Long	客户
                     customerName: '', //	是	String	客户名称
                     businessCompany: '', //	是	string	业务所属公司
                     orderId: '', //	是	Long	订单id
                     orderNo: '', //	是	string	订单编号
                     projectName: '', //	是	string	项目名称
                     projectSource: '', //	是	String	项目信息来源
                     startDate: '', //是	Date	起租日期
                     endDate: '', //	是	Date	到租日期
                     usedDays: '', //	是	Long	使用天数
                     totalDailyRent: '', //	是	BigDecimal	日租金合计
                     rentReceivable: 0, //	是	BigDecimal	应收租金
                     rentAllowanceAmount: 0, //	是	BigDecimal	租金折让金额
                     rentAllowanceDescription: '', //	是	String	折让说明
                     relationApprovalForm: '', //	是	String	关联特殊事项审批单
                     totalOtherExpenses: '', //	是	BigDecimal	其他费用总额
                     rentPaid: '', //	是	BigDecimal	实收租金
                     depositPaid: '', //	是	BigDecimal	实收押金
                     refundableDeposit: '', //	是	BigDecimal	应退押金
                     accountStatementAttachments: '', //	是	String	对账单附件
                     accountNumber: '', //	是	String	帐户信息附件
                     totalDeductibleExpenses: '', //	是	BigDecimal	应扣费用总额
                     totalLogisticsExpenses: '', //	是	BigDecimal	物流费用总额
                     totalMaintenanceCost: '', //	是	BigDecimal	维修费用总额
                     estimateProjectProfit: '', //	是	BigDecimal	预估项目毛利
                     signRenId: '', //	是	Long	签订人id
                     signRenName: '', //	是	String	签订人名称
                     collaborator: '', //	是	Long	协同人id
                     collaboratorName: '', //	是	String	协同人名称
                     otherExpensesList: [], //	是	[]	收取客户其他费用
                     deductibleExpensesList: [], //	是	[]	项目应扣费用对象
                     logisticsExpensesList: [], //	是	[]	物流及辅料费用对象
                     maintenanceCostList: [], //
                     statementExpensesList: [] ,//结算费用表
					 statementOrderList:[],//关联订单表
					 payAmount:0,
					 refundableDeposit:0,
					 openingBank:'',//开户行名称
					 taxRatio:0,//税率
					 taxAmount:0,//税费
					 estimateProjectProfit:0,//项目毛利
					 partnerRatio:0,//合伙人分成比例
					 partnerAmount:0,//合伙人分成金额
					 salesmanRatio:0,//业务员分成比例
					 salesmanAmount:0,//业务员分成金额
					 projectEngineerCostList:[],
					 totalProjectEngineerCost:0,
					 
                 },
				 salesmanRatioShow:true,
				 taxRatioShow:false,//税率
				 taxRatiocolumns:[],//税率
				 partnerRatioShow:false,//合伙人
				 partnerRatiocolumns:[],
				 sealemanshow:false,
				 sealemancolum:[],
                 statementShow:false,
                 type: 1, //控制右边弹框的
                 businessCompanyOptions: [], //业务公司
                 businessCompany: '', //业务公司显示
                 projectSourceOptions: [], //项目信息来源
                 projectSource: '', //显示项目信息来源
                 startDate: '',
                 endDate: '',
                 expenseTypeOption: [], //费用类别
                 expenseUnitOption: [], //费用单位类别
                 isPay: [], //是否支付
                 modelOption: [], //型号集合
                 totalMachineExpense: 0, //总租金
                 machineExpenseList: '', //机器的详情展示列表
                 statementExpensesList: [],
                 expenseType: '', //费用类别展示
                 unit: '', //选择显示单位
                 BtnShow: false,
                 businessCompanyOptionsDou: [],
                 expensesForm: {
                     expenseCategory: '',
                     unit: '',
                     // quantity:'',
                     // totalAmount:'',
                     hasPaid: '',
                     expenseDate: '',
                     model: '',
                 }, //费用表单
                 moneyShow: false,
                 statementExpensesList: [],
				 expenseTypeOption:[],//费用类别
				 expenseUnitOption:[],//费用单位类别
				 isPay:[],//是否支付
				 expenseTypeShow:false,
				 expenseUnitShow:false,
				 payShow:false,
				 	modelShow:false,
                 backIndex: false,
                 machineFromData: {
                     machineNo: ""
                 }, //扫码时间机器
                 // 出库单子级产品列表
                 outProductListInfo: [],
                   // 结算单
				   finnalStatement:false,
				   FinalStatementForm:{},
				   active:0,
				   showAgree:false,
				   showRefouse:false,
				   approvalForm:{
				   },
				   copylist:[],//抄送人
				   buttonShow:false,//审批按钮是否显示
				   
             }
			 

         },
         onLoad(e) {
             console.log(e);
             this.id = e.id
             this.getPay()
             this.getShippingType()
             this.getcustomerSource()
             this.getCustomertype()
             this.getBusinessCompany()
             this.getProjectSource()
             this.getLease()
           
			 
             this.getuser()
             this.permissions = this.$store.getters.permissions
             // 出库单数据获取
             // this.getOutform()
             this.getExpenseType()
             this.getExpenseUnit()
             this.getPay()
             this.getModel()
              
			 
            
         },
          created() {
			  // this.changecopy()
			   this.initData()
          	this.getlogicList()
			  this.dateNow=this.getNowTime()
			  this.getShui()
			  this.gethehuo()
			  this.getseamancolum()
          },
         methods: {
			 // 获取税率
			 getShui(){
				 getDicts('shuilv').then(res=>{
					 this.taxRatiocolumns.push(res.data)
				 })
			 },
			 taxRatioConfirm(e){
				  this.taxRatioShow=false
				 this.statementForm.taxRatio=e.value[0].dictLabel
				 this.sumtaxRatio()
				
			 },
			 // 合伙人分成比例
			 gethehuo(){
				 getDicts('hehuo').then(res=>{
					 this.partnerRatiocolumns.push(res.data)
				 })
			 },
			 partnerRatioConfirm(e){
				 this.partnerRatioShow=false
				 this.statementForm.partnerRatio=e.value[0].dictLabel
				 this.sumpartnerRatio()
			 },
			 // 业务员分成比例
			 
			 getseamancolum(){
				getDicts('sealeman').then(res=>{
					this.sealemancolum.push(res.data)
				}) 
			 },
			 sealemanConfirm(e){
				 this.sealemanshow=false
				 this.statementForm.salesmanRatio=e.value[0].dictLabel
				 this.sumsalesmanRatio()
			 },
			 // 取两位小数
			 getmathtwo(val){
				 return Math.floor(val*100)/100
				 
			 },
			 sumtaxRatio(){
				 // 计算税费
				 // 税费=应收合计X税率
				 this.statementForm.taxAmount=0
				 this.statementForm.taxAmount=Number(this.statementForm.payAmount)*parseFloat(this.statementForm.taxRatio)*0.01
			this.statementForm.taxAmount=this.getmathtwo(this.statementForm.taxAmount)
			 // 项目毛利=应收合计-项目应扣费用-物流辅料费用-维修配件费用-税费
			 this.statementForm.estimateProjectProfit=0
			 this.statementForm.estimateProjectProfit=Number(this.statementForm.payAmount)-Number(this.statementForm.totalDeductibleExpenses) - Number(this.statementForm.totalLogisticsExpenses) -Number(this.statementForm.totalMaintenanceCost)-Number(this.statementForm.taxAmount)
			this.statementForm.estimateProjectProfit=this.getmathtwo(this.statementForm.estimateProjectProfit)
			 this.sumpartnerRatio()
			 this.sumsalesmanRatio()
			 },
			 // 合伙人分成
			 sumpartnerRatio(){
				// 合伙人分成金额=项目毛利X合伙人分成比列
				this.statementForm.partnerAmount=0
				this.statementForm.partnerAmount=Number(this.statementForm.estimateProjectProfit)*parseFloat(this.statementForm.partnerRatio)*0.01
			    this.statementForm.partnerAmount=this.getmathtwo(this.statementForm.partnerAmount)
				
			 // 项目剩余毛利
			 this.statementForm.residualProjectProfit=0
			  this.statementForm.residualProjectProfit=Number(this.statementForm.estimateProjectProfit)-Number(this.statementForm.partnerAmount)
			this.statementForm.residualProjectProfit=this.getmathtwo(this.statementForm.residualProjectProfit)
			this.sumsalesmanRatio()
			 },
			 // 业务员分成
			 sumsalesmanRatio(){
			// 业务员提成金额=项目剩余毛利*提成比列
				 this.statementForm.salesmanAmount=0
				 this.statementForm.salesmanAmount=Number(this.statementForm.residualProjectProfit)*parseFloat(this.statementForm.salesmanRatio)*0.01
			      this.statementForm.salesmanAmount=this.getmathtwo(this.statementForm.salesmanAmount)
				   
			 },
			
			 // 获取订单关联物流信息
			async getlogicList(){
				console.log(this.list.orderNo);
				
				 },
			 // 打开选择项目弹框
			 async  openOrderFn(){
			       this.orderListShow=true
			 	  // 获取订单
			 	  let res=await listOrder({customerName:this.list.customerName})
			 	  this.OrderListInfo=res.rows
				  this.OrderListInfo.forEach((item,index)=>{
					  if(item.orderNo==this.list.orderNo){
						this.OrderListInfo.splice(index,1)
					  }
				  })
			      },
			 async checked(val){
				 this.statementForm.statementOrderList.push({
					 orderId:val.id,
					 orderNo:val.orderNo,
					 customerId:val.customerId,
					 customerName:val.customerName,
					 projectId:val.projectId,
					 projectName:val.projectName,
					 projectAddress:val.address,
					 projectSource:val.projectSource,
					 consigneeName:val.consigneeName,
					 consigneeTel:val.consigneeTel,
				 })
				 this.orderListShow=false
				 // 查询对应对账单
				  let res=await getStatementListApi({orderNo:val.orderNo})
				  // 累加计算
				  this.statementExpensesList.push(...res.rows[0].statementExpensesList)
				// 计算机器租赁费
					 this.setDailyTotalRent()
					this.statementForm.otherExpensesList.push(...res.rows[0].otherExpensesList)
					 
					    this.statementForm.totalOtherExpenses = 0
					    this.statementForm.otherExpensesList.forEach(item => {
					        this.statementForm.totalOtherExpenses += Number(item.totalAmount)
					        console.log(this.statementForm.otherExpensesList);
					    })
				 
					 this.statementForm.deductibleExpensesList.push(...res.rows[0].deductibleExpensesList)
					    this.statementForm.totalDeductibleExpenses = 0
					    this.statementForm.deductibleExpensesList.forEach(item => {
					        this.statementForm.totalDeductibleExpenses += Number(item.amount)
					    })
				 
					 this.statementForm.logisticsExpensesList.push(...res.rows[0].logisticsExpensesList)
					    this.statementForm.totalLogisticsExpenses = 0
					    this.statementForm.logisticsExpensesList.forEach(item => {
					        this.statementForm.totalLogisticsExpenses += Number(item.amount)
					    })
					 
					   this.statementForm.maintenanceCostList.push(...res.rows[0].maintenanceCostList)
					    this.statementForm.totalMaintenanceCost = 0
					    this.statementForm.maintenanceCostList.forEach(item => {
					        this.statementForm.totalMaintenanceCost += Number(item.totalAmount)
					    })
 // 租金折让累加、			 					
this.statementForm.rentAllowanceAmount+=Number(res.rows[0].rentAllowanceAmount)
// 已收押金折累加	  
this.statementForm.depositPaid+=Number(res.rows[0].depositPaid)
// 应收合计=机器租赁费+应收客户其他费用-折让费用
this.statementForm.payAmount = 0
this.statementForm.payAmount += Number(this.totalMachineExpense) + Number(this.statementForm.totalOtherExpenses)-Number(this.statementForm.rentAllowanceAmount)
// 应退押金=已收押金-应收合计
this.statementForm.refundableDeposit=0
this.statementForm.refundableDeposit=Number(this.statementForm.depositPaid)-Number(this.statementForm.payAmount)
// 未收金额=应收合计-已收押金
this.statementForm.uncollected=0
this.statementForm.uncollected=Number(this.statementForm.payAmount)-Number(this.statementForm.depositPaid)		
// 税费=应收合计X税率
this.statementForm.taxAmount=0
this.statementForm.taxAmount=Number(this.statementForm.payAmount)*parseFloat(this.statementForm.taxRatio)*0.01
this.statementForm.taxAmount=this.getmathtwo(this.statementForm.taxAmount)
// 项目毛利=应收合计-项目应扣费用-物流辅料费用-维修配件费用-税费
this.statementForm.estimateProjectProfit=0
this.statementForm.estimateProjectProfit=Number(this.statementForm.payAmount)-Number(this.statementForm.totalDeductibleExpenses) - Number(this.statementForm.totalLogisticsExpenses) -Number(this.statementForm.totalMaintenanceCost)-Number(this.statementForm.taxAmount)-Number(this.statementForm.totalProjectEngineerCost)
this.statementForm.estimateProjectProfit=this.getmathtwo(this.statementForm.estimateProjectProfit)
// 合伙人分成金额=项目毛利X合伙人分成比列
this.statementForm.partnerAmount=0
this.statementForm.partnerAmount=Number(this.statementForm.estimateProjectProfit)*parseFloat(this.statementForm.partnerRatio)*0.01
this.statementForm.partnerAmount=this.getmathtwo(this.statementForm.partnerAmount)
// 项目剩余毛利
this.statementForm.residualProjectProfit=0
this.statementForm.residualProjectProfit=Number(this.statementForm.estimateProjectProfit)-Number(this.statementForm.partnerAmount)
this.statementForm.residualProjectProfit=this.getmathtwo(this.statementForm.residualProjectProfit)
// 业务员提成金额=项目剩余毛利*提成比列
this.statementForm.salesmanAmount=0
this.statementForm.salesmanAmount=Number(this.statementForm.residualProjectProfit)*parseFloat(this.statementForm.salesmanRatio)*0.01
this.statementForm.salesmanAmount=this.getmathtwo(this.statementForm.salesmanAmount)			
						
			 },
			 // 删除关联订单
			 delOrderInfoFn(val){
				 this.statementForm.statementOrderList.splice(val,1)
				 
			 },
       
             photoFn() {
                 console.log('11');
                 uni.navigateTo({
                     url: `http://101.132.141.5:8081${this.list.enclosure}`
                 })
             },
            
             async BtnModel1() {
                 this.BtnShow1 = false
                 let res = await getApprovalList({
                     orderId: this.list.id
                 })
                 await editApprovalInfo({
                     id: res.rows[0].id,
                     orderId: res.rows[0].orderId,
                     orderNo: res.rows[0].orderNo,
                     marketingUserId: res.rows[0].marketingUserId,
                     marketingUserName: res.rows[0].marketingUserName,
                     financeUserId: this.user.userId,
                     financeUserName: this.user.username
                 })
                 await updateOrderStatus({
                     id: this.list.id
                 })
                 await this.initData()
				 
             },

             //获取登录用户
             async getuser() {
                 let res = await getLoginUser()
				 console.log(res,'用户信息');
				 res.user.user.roles.forEach(item=>{
					 if(item.roleName=='渠道业务员'){
						 this.salesmanRatioShow=false
					 }
				 })
                 this.user = res.user
                 this.userId = res.user.userId
             },
           
// 同意
		btnOk(){
			this.showAgree=true
		},
// 拒绝
		btnRe(){
			this.showRefouse=true
		},
		// 同意审批
		async approverFn(){
			this.approvalForm.serialNum=this.list.orderNo
			this.approvalForm.typeOperation="agree"
			this.showAgree=false
			await editapprovalRecode(this.approvalForm)
			var that=this
			this.$refs.uToast.show({
				type:'success',
				message:'审批成功',
				complete(){
					that.buttonShow=false
					  that.initData()
				}
			})
			
		},
		// 拒绝
		async approverReFn(){
			this.approvalForm.serialNum=this.list.orderNo
			this.approvalForm.typeOperation="rejected"
			this.showRefouse=false
			await editapprovalRecode(this.approvalForm)
			
			var that=this
			this.$refs.uToast.show({
				type:'success',
				message:'成功驳回',
				complete(){
					// 修改订单状态
					updateOrder({id:that.list.id,orderStatus:'12'}) 
				}
			})
			 this.buttonShow=false
			await this.initData()
		},
		// 抄送 点击详情页面即为查看
		async changecopy(){
			 let res=await getcopylist({serialNum:this.list.orderNo})
			 console.log(res.rows);
			 res.rows.forEach(async item=>{
				 if(item.copyerId==this.$store.getters.userid){
					await  editcopyapi({copyerId:this.$store.getters.userid,serialNum:this.list.orderNo}).then(async res=>{
						 let res3=await getcopylist({serialNum:this.list.orderNo})
					       this.copylist=res3.rows
					 })
				     
				 }
			 })
		},
		
             async initData() {
                 const res = await getOrder(this.id)
                 console.log(res);
                 this.list = res.data
                 this.customerCategory = this.getValue(this.customerOption, res.data.customerCategory)
                 this.businessCompany = this.getValue(this.businessCompanyOptions, res.data.businessCompany)
                console.log(this.businessCompany,this.businessCompanyOption,'21321');
				 this.customerSource = this.getValue(this.customerSourceOption, res.data.customerSource)
                 this.projectSource = this.getValue(this.projectSourceOption, res.data.projectSource)
                 this.shippingType = this.getValue(this.shippingTypeOption, res.data.shippingType)
                 this.depositCollectionMethod = this.getValue(this.depositCollectionMethodOption, res.data
                     .depositCollectionMethod)
                 this.lease = this.getValue(this.leaseOPtion, res.data.lease)
                 this.productList = res.data.productList
               // 获取对应物流
	     let res1=await getLogisticsListApi({orderNo:this.list.orderNo})
			    this.logisclist=res1.rows
				 
				  // 获取审批信息
				  this.ApprovalList=[]
		let res2=await getapprovalRecodeList({serialNum:this.list.orderNo})
				   var arr=res2.rows
				  for(var i=0;i<arr.length;i++){
				    for(var j=i+1;j<arr.length;j++){
				      //如果第一个比第二个大，就交换他们两个位置
				      if( arr[i].sequence>arr[j].sequence){
				        var temp = arr[i];
				        arr[i] = arr[j];
				        arr[j] = temp;
				      }
				    }
				  }
				  this.ApprovalList=arr
				   this.active=0
				    this.ApprovalList.forEach(item=>{
						if(item.approvalStatus==="completed"){
							this.active++
						}
					})
					//判断按钮是否显示
					      this.ApprovalList.forEach(item=>{
					        if(item.approvalStatus=='approve'){
					
					          if(this.$store.getters.userid===item.approverId){
					
					            this.buttonShow=true
					          }
					        }
					      })
						  this.copylist=[]
	            let res3=await getcopylist({serialNum:this.list.orderNo})
				this.copylist=res3.rows
				await this.changecopy()
			   // 判断是否有出库单
			   await this.isOutform()
			   
             },
             // 客户类别
             getCustomertype() {
                 getDicts('biz_category').then(response => {
                     this.customerOption = response.data
                 })
             },
             // 业务所属公司
             getBusinessCompany() {
                 getDicts('biz_business_company').then(response => {
                     this.businessCompanyOption = response.data
					
                 })
             },
             // 客户来源
             getcustomerSource() {
                 getDicts('biz_source').then(response => {
                     this.customerSourceOption = response.data
                 })
             },
             // 项目信息
             getProjectSource() {
                 getDicts('biz_project_source').then(response => {
                     this.projectSourceOption = response.data
                 })
             },
             //  
             getPay() {
                 getDicts('pay_ment').then(response => {
                     this.depositCollectionMethodOption = response.data
                 })
             },
             getShippingType() {
                 getDicts('biz_shipping_type').then(response => {
                     this.shippingTypeOption = response.data
                 })
             },
             getLease() {
                 getDicts('biz_lease').then(response => {
                     this.leaseOPtion = response.data
                     console.log(this.leaseOPtion);
                 })
             },
             getValue(arr, item) {
                 for (var i = 0; i < arr.length; i++) {
                     if (item == arr[i].dictValue) {
                         return arr[i].dictLabel
                     }
                 }
             },
             // 机器维修 获取机器列表
             async getMachine() {
                 const res = await getMachineList2({
                     orderId: this.id
                 })
                 // console.log(res);
                 this.machinelist = res.rows
                 // console.log(this.machinelist);
             },
             // 获取项目支出列表
             async openProjectList() {
                 const res = await getProjectExpendListApi(this.formData.projectName)
                 // console.log(res);
                 this.moneyList = res.rows
             },
             async changeFn(e) {
                 console.log(e);
                 if (e.index == 0) {
                     this.index = 0
                 }
                 if (e.index == 1) {
                     this.index = 1
                 }
                 if (e.index == 2) {
                     this.index = 2
                     this.getMachine()
                 }
                 if (e.index == 3) {
                     this.index = 3
                     this.formData.projectName = this.list.projectName
                     this.openProjectList()
                 }
                 if (e.index == 4) {
                     this.index = 4
                     let res = await getapprovalRecodeList({
                         serialNum: this.list.orderNo
                     })
                     this.ApprovalList = res.rows
                 }
                 if (e.index == 5) {
                     this.index = 5

                 }
                 if (e.index == 6) {
                     this.index = 6
                 }

             },
             //项目支出添加按钮
             addBtn(e) {
                 // console.log(e);
                 if (e.id) {
                     this.formData = e
                 } else {
                     // 添加
                     this.formData.projectName = this.list.projectName
                 }
                 this.show = true

             },
             async addMoneyBtn() {
                 // console.log(val);
                 if (this.formData.id) {
                     // 修改
                     await editProjectExpendApi(this.formData)
                     this.openProjectList()
                     this.show = false
                 } else {
                     // 添加
                     await addProjectExpendApi(this.formData)
                     this.openProjectList()
                     this.show = false
                 }

             },
             // 删除
             async delBtn(val) {
                 await delProjectExpendApi(val.id)
                 this.openProjectList()
             },
             // 点击报修按钮 跳转
             repairBtn(item) {
                 console.log(item);
                 console.log(this.list);
                 item.orderNo = this.list.orderNo
                 item.orderId = this.list.id
                 uni.navigateTo({
                     url: '/pages/repair/addRepair/index?item=' + JSON.stringify(item)
                 })
             },
             back() {
                 uni.navigateBack({
                     delta: 1
                 })
             },
             toeditFn() {
                 uni.navigateTo({
                     url: '/pages/order/addOrder/addOrder?orderInfo=' + JSON.stringify(this.list)
                 })
             },
             toInfo(val, item) {
                 let result = [val, item].join(',')
                 uni.navigateTo({
                     url: '/pages/repair/index?info=' + JSON.stringify(result)
                 })
             },

             async isOutform() {
				 let  res=await getapprovalRecodeList({serialNum:this.list.orderNo})
               let res1=res.rows.every(item=>
					item.approvalStatus==="completed"
				)
				 if (this.list.orderStatus == 0 && res1==true) {
					 this.Outform.parentId=0
                     this.Outform.outboundNo = this.setOrderNo()
                     this.Outform.orderId = this.list.id
                     this.Outform.orderNo = this.list.orderNo
                     this.Outform.sponsor = this.list.sponsor
                     this.Outform.sponsorName = this.list.sponsorName
                     this.Outform.sponsorName = this.list.sponsorName
                     this.Outform.customerId = this.list.customerId
                     this.Outform.customerName = this.list.customerName
                     this.Outform.orderType = this.list.orderType
                     this.Outform.outboundWarehouseId = this.list.deliveryWarehouseId
                     this.Outform.outboundWarehouseName = this.list.deliveryWarehouseName
                     this.Outform.totalDailyRent = this.list.totalDailyRent
                     this.productList = this.list.productList

                     await addOrderApi(this.Outform)
                     this.$refs.uToast.show({
						 type:'success',
                         message: '出库单已生成，请联系仓库进行发货',
						 complete(){
							 this.getOutform()
						 }
                     })
					 
                 } else {
                      this.getOutform()

                 }
             },
             // 获取出库单
             // 订单详情页面打开时，页面根据条件请求数据
             async getOutform() {
				
                 let res = await listHouse({
                     orderNo: this.list.orderNo
                 })
				  
				   this.Outform = res.rows[0]
				 let res1=await listHouse3({
					 id:res.rows[0].id
				 })
				 
               
				  this.outProductListInfo=res1.rows
                 
             },
            

            
             // 回货申请
             async openBack() {
                 this.backIndex = true
                 let res = await getBackWarehouseList({
                     orderNo: this.list.orderNo
                 })
				 
                 if (res.rows.length == 0) {
                     this.Backform.returnApplyNo = this.setBackOrderNo()
					 this.Backform.parentId=0
                     this.Backform.orderId = this.list.id
                     this.Backform.orderNo = this.list.orderNo
                     this.Backform.sponsor = this.list.salesman
                     this.Backform.sponsorName = this.list.salesmanName
                     this.Backform.customerId = this.list.customerId
                     this.Backform.customerName = this.list.customerName
                     this.Backform.totalDailyRent = this.list.totalDailyRent
                     this.Backform.collaborator = this.list.collaborator
					 this.Backform.contactName=this.list.consigneeName
					 this.Backform.contactTelephone=this.list.consigneeTel
                     this.Backform.collaboratorName = this.list.collaboratorName
                     this.Backform.warehouseId = this.list.deliverWarehouseId
                     this.Backform.warehouseName = this.list.deliveryWarehouseName
                     this.Backform.salesman = this.list.salesman
                     this.Backform.salesmanName = this.list.salesmanName
					 this.Backform.projectName=this.list.projectName
                     this.Backform.productList = this.list.productList
                     this.Backform.loadingAddress = this.list.address
                     await addBackWarehouseApi(this.Backform)
                     this.$refs.uToast.show({
						 type:'success',
                         message: '回货申请单已创建，请选择回货产品'
                     })
					 let res1=await getBackWarehouseList({
                     orderNo: this.list.orderNo
                 })
				  this.Backform=res1.rows[0]
                 } else {
                     this.Backform = res.rows[0]
                 }


             },
			 // 修改回货产品校验
          isQuantity(val,index,items){
			  var arr=[]
			  this.Backform.childReturnApply.forEach(item=>{
				  arr.push(JSON.stringify(item))
			  })
			  
			   this.backeditShow=arr.indexOf(JSON.stringify(items))
			   // 数量校验
			   var newArr=[]
			   this.Backform.childReturnApply.forEach(item=>{
				   newArr.push(...item.productList)
			   })
			// 获取当前型号的所有申请所有数量
			 var modelNum=0
			 var modelArr=[]
			 newArr.forEach(itemds=>{
				 if(itemds.model==val.model){
					 modelArr.push(itemds)
				 }
			 })
			 modelArr.forEach(item=>{
				 modelNum+=Number(item.returnQuantity)
				 console.log(modelNum);
			 })
			 // 订单产品的该型号的数量
			 var orderModelNum=0
			 this.productList.forEach(item=>{
				 if(val.model==item.model){
					 orderModelNum=item.quantity
				 }
			 })
			 console.log(modelNum,orderModelNum,val.returnQuantity,'数量');
			 // 可修改数量最大为= 订单该产品数量-已申请所有数量+修改前数量
			 if(Number(val.returnQuantity)>Number(orderModelNum)-Number(modelNum)+Number(val.returnQuantity)){
				 this.$refs.uToast.show({
					 type:'warning',
					 message:`单签可申请数量为：${Number(orderModelNum)-Number(modelNum)+Number(val.returnQuantity)}`,
				 })
				 val.returnQuantity=null
			 }
			 
		  },
		  // 修改回货申请单
		  editbackform(val){
			  editBackWarehouseApi(val).then(res=>{
				  var that=this
				  this.$refs.uToast.show({
					  type:'success',
					  message:'修改成功',
					  complete(){
						   that.openBack()
					  }
				  })
				 
			  })
		  },
             // 添加子级申请单
             async addBackproductList() {
                 // 校验产品是否申请完毕
                 let orderInfo = await listOrder({
                     orderNo: this.list.orderNo
                 })
				  
                 if (orderInfo.rows[0].orderStatus == '3' || orderInfo.rows[0].orderStatus == '4' || orderInfo.rows[
                         0].orderStatus == '5' || orderInfo.rows[0].orderStatus == '6') {
                     this.$refs.uToast.show({
                         type: 'warning',
                         message: '该申请已完成',
                     })
                 } else {
                     uni.navigateTo({
                         url: '/pages/backapplication/addbackapplication/addbackapplication?item=' +
                             encodeURIComponent(JSON.stringify(this.Backform))
                     })
                 }

             },
			 
			 // 展开对账单
             async openStatement() {
				 //根据到货日期和扫码入库日期计算应收租金
				 let arr=[]
			this.outProductListInfo.forEach(item=>{
				arr.push(...item.machineList)
			})
			let days=0
			let moneys=0
			arr.forEach(item=>{
				 days=this.getDayBetween(item.logisticsTime,item.warehouseTime)
				 
				  moneys+=days*item.dailyRent
				  console.log(moneys,days, item,'租赁费');
				 
				   
				  // console.log(this.statementForm.rentReceivable);
			})
			  this.statementForm.rentReceivable=moneys
              
                 this.statementShow = true
                 let statementList = await getStatementListApi({
                     orderNo: this.list.orderNo
                 })
                 if (statementList.rows.length == 0) {
					 // 如果包干金额存在
					 if(this.list.lumpAmount!==0||this.list.lumpAmount!==""||this.list.lumpAmount!==null){
						 this.totalMachineExpense=this.list.lumpAmount
					 }
                     this.statementForm.number = this.setStatementNo()
					 
                     this.statementForm.contractTemplate = this.list.contractTemplate
                     this.statementForm.sponsor = this.list.sponsor
                     this.statementForm.sponsorName = this.list.sponsorName
                     this.statementForm.signRenId = this.list.salesman
                     this.statementForm.signRenName = this.list.salesmanName
                     this.statementForm.salesman = this.list.salesman
                     this.statementForm.salesmanName = this.list.salesmanName
                     this.statementForm.applyDate = this.list.createTime
                     this.statementForm.customerId = this.list.customerId
                     this.statementForm.customerName = this.list.customerName
                     this.statementForm.businessCompany = this.list.businessCompany
                     this.statementForm.orderId = this.list.id
                     this.statementForm.orderNo = this.list.orderNo
                     this.statementForm.projectName = this.list.projectName
                     this.statementForm.projectSource = this.list.projectSource
                     this.statementForm.totalDailyRent = this.list.totalDailyRent
                     // this.statementForm.rentReceivable = this.list.totalRant
                     this.statementForm.collaborator = this.list.collaborator
                     this.statementForm.collaboratorName = this.list.collaboratorName
                     this.statementForm.depositPaid = this.list.receivedAmount
                     this.businessCompany = this.getValue(this.businessCompanyOptions, this.list.businessCompany)
                     this.projectSource = this.getValue(this.projectSourceOptions, this.list.projectSource)
                     
					 // 获取物流的费用表单
                     const res1 = await getLogisticsListApi({
                         orderId: this.list.id
                     })
                     res1.rows.forEach((item) => {
                         let newItem = {}
                         if (item.createTime) {
                             newItem.date = item.createTime
                             delete item.createTime
                         }
                         if (item.logisticsExpenses) {
                             newItem.amount = item.logisticsExpenses
                             delete item.logisticsExpenses
                         }
                         newItem.expenseCategory = 1
                         newItem.orderId = null
                         newItem.orderType = 1
                         newItem.quantity = null
                         newItem.model = null
                         newItem.payer = null

                         this.statementForm.logisticsExpensesList.push(newItem)

                     })
                     // this.expenseType=this.getValu2(this.expenseTypeOption,1)
                     this.statementForm.totalLogisticsExpenses = 0
                     this.statementForm.logisticsExpensesList.forEach(item => {
                         this.statementForm.totalLogisticsExpenses += Number(item.amount)
                     })

                     // 获取维修的费用
                     const res2 = await repairListApi({
                         orderId: this.list.id
                     })
                     res2.rows.forEach((item, index) => {
                         let newItem = {}
                         if (item.repairAmount) {
                             newItem.totalAmount = item.repairAmount
                         }
                         if (item.repairDescription) {
                             newItem.remark = item.repairDescription
                             delete item.repairDescription
                         }
                         newItem.expenseCategory = 2
                         newItem.orderId = null
                         newItem.orderType = 1
                         newItem.unit = null
                         this.statementForm.maintenanceCostList.push(newItem)
                     })

                     // this.expenseType=this.getValu2(this.expenseTypeOption,1)
                     this.statementForm.totalMaintenanceCost = 0
                     this.statementForm.maintenanceCostList.forEach(item => {
                         this.statementForm.totalMaintenanceCost += Number(item.totalAmount)
                     })
                     // 工程费获取/放在项目其项目应扣费用
                     let res4 = await listCost({
                         orderNo: this.list.orderNo
                     })
                     res4.rows.forEach(item => {
                         var newObject={
							 expenseCategory:'工程部费用',
							 orderType:'对账单',
							 unit:'元',
							 totalAmount:item.costs
						 }
						 this.statementForm.projectEngineerCostList.push(newObject)
                     })
                     this.statementForm.totalProjectEngineerCost = 0
                     this.statementForm.projectEngineerCostList.forEach(item => {
                         this.statementForm.totalProjectEngineerCost += Number(item.totalAmount)
                     })

                     // 应该收租金
                     this.statementForm.payAmount = 0
                     this.statementForm.payAmount += Number(this.totalMachineExpense) + Number(this.statementForm.totalOtherExpenses)-Number(this.statementForm.rentAllowanceAmount) 
						 // 应退押金=已收押金-应收合计
					this.statementForm.refundableDeposit=0
					this.statementForm.refundableDeposit=Number(this.statementForm.depositPaid)-Number(this.statementForm.payAmount)
						 
						 // 未收金额=应收合计-已收押金
					this.statementForm.uncollected=0
					this.statementForm.uncollected=Number(this.statementForm.payAmount)-Number(this.statementForm.depositPaid)
		
						 
                 } else {
                     this.statementForm = statementList.rows[0]
					 this.statementExpensesList=this.statementForm.statementExpensesList
                     
                      this.setDailyTotalRent()
                 }


             },
			
			 // 项目费用单位
			 getExpenseUnit(){
			 	getDicts('expense_type_unit').then(response=>{
			 		this.expenseUnitOption=response.data.map(item=>{
			 			return {name:item.dictLabel,value:item.dictValue}
			 		})
			 	})
			 },
			 // 获取型号
			 getModel(){
			 	let newArr=[]
			 	selectProductQuantityList({pageNum:1,pageSum:1000}).then(response=>{
			 		console.log(response);
			 		response.rows.forEach((item)=>{
			                 newArr.push(item.model)
			 		})
			 		this.modelOption.push(newArr)
			 	})
			 },
			 // 是否已支付
			 getPay(){
			 	getDicts('pay').then(response=>{
			 		this.isPay=response.data.map(item=>{
			 			return {name:item.dictLabel,value:item.dictValue}
			 		})
			 	})
			 },
			 
			 // 上传附件
			 // 删除图片
			 deletePic(event) {
			     this[`fileList${event.name}`].splice(event.index, 1)
			 },
			 // 新增图片
			 async afterRead(event,name) {
			     // 当设置 multiple 为 true 时, file 为数组格式，否则为对象格式
			     let lists = [].concat(event.file)
			     let fileListLen = this[`fileList${event.name}`].length
			     lists.map((item) => {
			         this[`fileList${event.name}`].push({
			             ...item,
			             status: 'uploading',
			             message: '上传中'
			         })
			 
			     })
			     for (let i = 0; i < lists.length; i++) {
			         console.log();
			         const result = await this.uploadFilePromise(lists[i].url)
			 
			         let item = this[`fileList${event.name}`][fileListLen]
			         this[`fileList${event.name}`].splice(fileListLen, 1, Object.assign(item, {
			             status: 'success',
			             message: '附件图片',
			             url: result
			         }))
			         fileListLen++
			     }
			 
			 
			     console.log(this.fileList1);
			 },
			 uploadFilePromise(url) {
			     return new Promise((resolve, reject) => {
			         let a = uni.uploadFile({
			             url: 'http://101.132.141.5:8081/common/upload', // 仅为示例，非真实的接口地址
			             filePath: url,
			             header: this.headers,
			             name: 'file',
			             statementForm: {
			                 user: 'test'
			             },
			 
			             success: (res) => {
							  if(event.name=='1'){
								   this.statementForm.accountStatementAttachments = JSON.parse(res.data).fileName
							  }else if(event.name=='2'){
								  this.statementForm.accountAttachments=JSON.parse(res.data).fileName
							  }
			                  
			                 setTimeout(() => {
			                     resolve(res.data.data)
			 
			                 }, 1000)
			               
			             }
			         });
			     })
			 },
             // 业务所属公司
             getBusinessCompany() {
                 getDicts('biz_business_company').then(response => {
                     // console.log(response);
                     this.businessCompanyOptions = response.data
                     this.businessCompany = this.getValue(this.businessCompanyOptions, this.formData
                         .businessCompany)

                 })
             },
             
             // 费用类别
             getExpenseType() {
                 getDicts('expense_type').then(response => {
                     // expenseTypeOption
                     this.expenseTypeOption = response.data.map(item => {
                         return {
                             name: item.dictLabel,
                             value: item.dictValue
                         }
                     })
                 })
             },
              
             // 生成对账单编号
			 
             setStatementNo() {
                 var date = new Date();
                 var year = date.getFullYear(); //年 ,从 Date 对象以四位数字返回年份
                 var month = date.getMonth() + 1; //月 ,从 Date 对象返回月份 (0 ~ 11) ,date.getMonth()比实际月份少 1 个月
                 var day = date.getDate(); //日 ,从 Date 对象返回一个月中的某一天 (1 ~ 31)
                 //修改月份格式
                 if (month >= 1 && month <= 9) {
                     month = "0" + month;
                 }
                 //修改日期格式
                 if (day >= 0 && day <= 9) {
                     day = "0" + day;
                 }

                 let round = Math.floor(Math.random() * (999 - 100)) + 100;
                 var currentFormatDate = `${year}${month}${day}`;
                 return "DZ" + currentFormatDate + round;
             },
             // 产品选择
             productListFn() {
                 uni.navigateTo({
                     url: '/pages/dialog/statementproduct/statementproduct?orderNo='+this.list.orderNo
                 })
             },
             // 接受产品数据
             getValueS(list) {
                 console.log(list);
                 this.statementExpensesList.push(...list)
             },
             // 打开时间弹框
             openDate(val, num) {
                 this.expectedArrivalDateShow = true
                 this.idx = val
                 this.Num = num
             },
			// 获取当前时间
			getNowTime(){
					var date= new Date()
					var month = date.getMonth() + 1;
					var time = date.getFullYear() + "-" + month + "-" + date.getDate();
					return time;},
			 						// 
			expectedArrivalDateConfirm(e){
			 		 if(this.Num==1){
			 		 this.statementExpensesList[this.idx].startDate=this.getTime(e.value)
			 		this.expectedArrivalDateShow=false
					  this.sumMoney(this.idx)
			 		}
			 		if(this.Num==2){
			 	this.statementExpensesList[this.idx].endDate=this.getTime(e.value)
			    this.expectedArrivalDateShow=false
			    this.sumMoney(this.idx)
			 		}
			 							
			 						},
			 						// 时间格式化
			getTime(val){
			 		var date = new Date(val);
			 		var year = date.getFullYear();        //年 ,从 Date 对象以四位数字返回年份
			 	    var month = date.getMonth() + 1;      //月 ,从 Date 对象返回月份 (0 ~ 11) ,date.getMonth()比实际月份少 1 个月
			 		var day = date.getDate();             //日 ,从 Date 对象返回一个月中的某一天 (1 ~ 31)
			 		//修改月份格式
			 		if (month >= 1 && month <= 9) {
			 		month = "0" + month;}
			 		//修改日期格式
			 	if (day >= 0 && day <= 9) {
			 	   day = "0" + day;}
			 	var currentFormatDate = `${year}-${month}-${day}`;
			 	return currentFormatDate
			 						},
             // 计算天数
             async sumMoney(idx) {
                 console.log(idx,"dghfka");
                 this.statementExpensesList[idx].days = this.getDayBetween(this.formatDate(this
                     .statementExpensesList[this.idx].startDate), this.formatDate(this
                     .statementExpensesList[this.idx].endDate))
                 console.log(this.statementExpensesList[idx].days);
                 this.statementExpensesList[idx].grossRent = parseFloat(this.statementExpensesList[idx].days) *
                     parseFloat(this.statementExpensesList[idx].dailyRent) * parseFloat(this.statementExpensesList[
                         idx].quantity)
                 console.log(this.statementExpensesList[idx].grossRent);
                 await this.setDailyTotalRent(idx)
             },
			 getDayBetween(start,end){
			  var startDate=Date.parse(start)
			   var endDate=Date.parse(end)
			   if(startDate>endDate){
			     return his.$refs.uToast.show({
						 type:"error",
						 message:'请重新选择日期'
					 }) 
			   }
			   if(startDate==endDate){
			     return 1
			   }
			   var days=(endDate-startDate)/(1*24*60*60*1000)
			   return days
			 },
		 
             //格式转换
             formatDate(d) {
                 var date = new Date(d);
                 var YY = date.getFullYear() + '-';
                 var MM =
                     (date.getMonth() + 1 < 10 ?
                         '0' + (date.getMonth() + 1) :
                         date.getMonth() + 1) + '-';
                 var DD = date.getDate() < 10 ? '0' + date.getDate() : date.getDate();

                 return YY + MM + DD
             },

             //计算天数
             getDayBetween(start, end) {
                 var startDate = Date.parse(start)
                 var endDate = Date.parse(end)
                 if (startDate > endDate) {
                     return this.$refs.uToast.show({
						 type:"error",
						 message:'请重新选择日期'
					 }) 
                 }
                 if (startDate == endDate) {
                     return 1
                 }
                 var days = (endDate - startDate) / (1 * 24 * 60 * 60 * 1000)
                 return days+1
             },
             setDailyTotalRent(index) {

                 //计算日租金
                 let total = 0
                 let arr = []
				 if(this.statementExpensesList.length==0){
					 this.totalMachineExpense=0
				 }
                 this.statementExpensesList.forEach((item, index) => {
                     if (item.quantity && item.dailyRent) {
                         total = parseFloat(item.quantity) * parseFloat(item.dailyRent) * parseFloat(item.days);
                         arr.push(total)
                     } 
                     // console.log(arr)
                     let sum = arr.reduce(function(prev, cur, index) {
                         return prev + cur;
                     })
                     // console.log(sum)
                     this.totalMachineExpense = sum

                 })

                // 应该收租金
                this.statementForm.payAmount = 0
                this.statementForm.payAmount += Number(this.totalMachineExpense) + Number(this.statementForm.totalOtherExpenses)-Number(this.statementForm.rentAllowanceAmount)
                	// 应退押金=已收押金-应收合计
                this.statementForm.refundableDeposit=0
                this.statementForm.refundableDeposit=Number(this.statementForm.depositPaid)-Number(this.statementForm.payAmount)
                	console.log(this.statementForm.refundableDeposit,'ui');
                	// 未收金额=应收合计-已收押金
                this.statementForm.uncollected=0
                this.statementForm.uncollected=Number(this.statementForm.payAmount)-Number(this.statementForm.depositPaid)
               // 税费=应收合计X税率
               this.statementForm.taxAmount=0
               this.statementForm.taxAmount=Number(this.statementForm.payAmount)*parseFloat(this.statementForm.taxRatio)*0.01
               this.statementForm.taxAmount=this.getmathtwo(this.statementForm.taxAmount)
               // 项目毛利=应收合计-项目应扣费用-物流辅料费用-维修配件费用-税费
               this.statementForm.estimateProjectProfit=0
               this.statementForm.estimateProjectProfit=Number(this.statementForm.payAmount)-Number(this.statementForm.totalDeductibleExpenses) - Number(this.statementForm.totalLogisticsExpenses) -Number(this.statementForm.totalMaintenanceCost)-Number(this.statementForm.taxAmount)-Number(this.statementForm.totalProjectEngineerCost)
               this.statementForm.estimateProjectProfit=this.getmathtwo(this.statementForm.estimateProjectProfit)
               // 合伙人分成金额=项目毛利X合伙人分成比列
               this.statementForm.partnerAmount=0
               this.statementForm.partnerAmount=Number(this.statementForm.estimateProjectProfit)*parseFloat(this.statementForm.partnerRatio)*0.01
               this.statementForm.partnerAmount=this.getmathtwo(this.statementForm.partnerAmount)
               // 项目剩余毛利
               this.statementForm.residualProjectProfit=0
               this.statementForm.residualProjectProfit=Number(this.statementForm.estimateProjectProfit)-Number(this.statementForm.partnerAmount)
               this.statementForm.residualProjectProfit=this.getmathtwo(this.statementForm.residualProjectProfit)
               // 业务员提成金额=项目剩余毛利*提成比列
               this.statementForm.salesmanAmount=0
               this.statementForm.salesmanAmount=Number(this.statementForm.residualProjectProfit)*parseFloat(this.statementForm.salesmanRatio)*0.01
               this.statementForm.salesmanAmount=this.getmathtwo(this.statementForm.salesmanAmount)			
               				
             },
             moneyBtn(item) {
                 console.log(item);
                 this.type = item
                 // this.expenseCategory
                 if (item == 1) {
                     this.expensesForm = {
                         expenseCategory: '',
                         unit: '',
                         quantity: '',
                         totalAmount: '',
                     } //费用表单
                 }
                 if (item == 2) {
                     this.expensesForm = {
                         expenseCategory: '',
                         unit: '',
                         hasPaid: '',
                         amount: '',
                         payer: ''
                     }
                 }
                 if (item == 3) {
                     this.expensesForm = {
                         expenseCategory: '',
                         quantity: '',
                         amount: '',
                         model: '',
                         expenseDate: '',
                         payer: '',
                     }
                 }
                 if (item == 4) {
                     this.expensesForm = {
                         expenseCategory: '',
                         unit: '',
                         quantity: '',
                         totalAmount: '',
                     }
                 }
                 this.moneyShow = true
             },
             // 费用类别的选择
             selectBtn(e) {
                 console.log(e);
                 this.expenseType = e.name
                 this.expensesForm.expenseCategory = e.value
                 console.log(this.expensesForm.expenseCategory);
             },
             // 费用单位的选择
             selectBtn2(e) {
                 this.unit = e.name
                 this.expensesForm.unit = e.value
                 console.log(this.expensesForm);
             },
             // 是否已支付
             selectBtn3(e) {
                 this.expensesForm.hasPaid = e.value
                 console.log(this.expensesForm);
             },
			 // 点击获取日期
			 dateBtn(){
			 	console.log('111');
			 	console.log(this.$refs.date);
			 	this.$refs.date.show()
			 },
             submitBtn() {
                 if (this.type == 1) {
                     this.statementForm.otherExpensesList.push(this.expensesForm)
                     // console.log(this.expensesForm);
                     this.statementForm.totalOtherExpenses = 0
                     this.statementForm.otherExpensesList.forEach(item => {
                         this.statementForm.totalOtherExpenses += Number(item.totalAmount)
                         console.log(this.statementForm.otherExpensesList);
                     })
                 }
                 if (this.type == 2) {
                     this.statementForm.deductibleExpensesList.push(this.expensesForm)
                     // console.log(this.expensesForm);
                     this.statementForm.totalDeductibleExpenses = 0
                     this.statementForm.deductibleExpensesList.forEach(item => {
                         this.statementForm.totalDeductibleExpenses += Number(item.amount)
                     })
                 }
                 if (this.type == 3) {
                     this.statementForm.logisticsExpensesList.push(this.expensesForm)
                     this.statementForm.totalLogisticsExpenses = 0
                     this.statementForm.logisticsExpensesList.forEach(item => {
                         this.statementForm.totalLogisticsExpenses += Number(item.amount)
                     })
                 }
                 if (this.type == 4) {
                     this.statementForm.maintenanceCostList.push(this.expensesForm)
                     // console.log(this.expensesForm);
                     this.statementForm.totalMaintenanceCost = 0
                     this.statementForm.maintenanceCostList.forEach(item => {
                         this.statementForm.totalMaintenanceCost += Number(item.totalAmount)
                     })
                 }
                // 应该收租金
                this.statementForm.payAmount = 0
                this.statementForm.payAmount += Number(this.totalMachineExpense) + Number(this
                        .statementForm.totalOtherExpenses)-Number(this.statementForm.rentAllowanceAmount)
                	// 应退押金=已收押金-应收合计
                	this.statementForm.refundableDeposit=0
                	this.statementForm.refundableDeposit=Number(this.statementForm.depositPaid)-Number(this.statementForm.payAmount)
                	console.log(this.statementForm.refundableDeposit,'ui');
                	// 未收金额=应收合计-已收押金
                		this.statementForm.uncollected=0
                		this.statementForm.uncollected=Number(this.statementForm.payAmount)-Number(this.statementForm.depositPaid)
                // 税费=应收合计X税率
                this.statementForm.taxAmount=0
                this.statementForm.taxAmount=Number(this.statementForm.payAmount)*parseFloat(this.statementForm.taxRatio)*0.01
                this.statementForm.taxAmount=this.getmathtwo(this.statementForm.taxAmount)
                // 项目毛利=应收合计-项目应扣费用-物流辅料费用-维修配件费用-税费
                this.statementForm.estimateProjectProfit=0
                this.statementForm.estimateProjectProfit=Number(this.statementForm.payAmount)-Number(this.statementForm.totalDeductibleExpenses) - Number(this.statementForm.totalLogisticsExpenses) -Number(this.statementForm.totalMaintenanceCost)-Number(this.statementForm.taxAmount)-Number(this.statementForm.totalProjectEngineerCost)
                this.statementForm.estimateProjectProfit=this.getmathtwo(this.statementForm.estimateProjectProfit)
                // 合伙人分成金额=项目毛利X合伙人分成比列
                this.statementForm.partnerAmount=0
                this.statementForm.partnerAmount=Number(this.statementForm.estimateProjectProfit)*parseFloat(this.statementForm.partnerRatio)*0.01
                this.statementForm.partnerAmount=this.getmathtwo(this.statementForm.partnerAmount)
                // 项目剩余毛利
                this.statementForm.residualProjectProfit=0
                this.statementForm.residualProjectProfit=Number(this.statementForm.estimateProjectProfit)-Number(this.statementForm.partnerAmount)
                this.statementForm.residualProjectProfit=this.getmathtwo(this.statementForm.residualProjectProfit)
                // 业务员提成金额=项目剩余毛利*提成比列
                this.statementForm.salesmanAmount=0
                this.statementForm.salesmanAmount=Number(this.statementForm.residualProjectProfit)*parseFloat(this.statementForm.salesmanRatio)*0.01
                this.statementForm.salesmanAmount=this.getmathtwo(this.statementForm.salesmanAmount)			
                							 

                 this.expenseType = ''
                 this.unit = ''
                 this.expensesForm = {}
                 this.moneyShow = false
             },
             // 删除
			async  removeProduct(index){
				 this.statementExpensesList.splice(index,1)
			      console.log(this.statementExpensesList)
				 await this.setDailyTotalRent()
				 this.$nextTick(function() {
				     // 应收租金
				    // 应该收租金
				this.statementForm.payAmount = 0
				this.statementForm.payAmount += Number(this.totalMachineExpense) + Number(this.statementForm.totalOtherExpenses)-Number(this.statementForm.rentAllowanceAmount)
				    	// 应退押金=已收押金-应收合计
				this.statementForm.refundableDeposit=0
				this.statementForm.refundableDeposit=Number(this.statementForm.depositPaid)-Number(this.statementForm.payAmount)
				    	console.log(this.statementForm.refundableDeposit,'ui');
				    	// 未收金额=应收合计-已收押金
				this.statementForm.uncollected=0
				this.statementForm.uncollected=Number(this.statementForm.payAmount)-Number(this.statementForm.depositPaid)
				  // 税费=应收合计X税率
				  this.statementForm.taxAmount=0
				  this.statementForm.taxAmount=Number(this.statementForm.payAmount)*parseFloat(this.statementForm.taxRatio)*0.01
				  this.statementForm.taxAmount=this.getmathtwo(this.statementForm.taxAmount)
				  // 项目毛利=应收合计-项目应扣费用-物流辅料费用-维修配件费用-税费
				  this.statementForm.estimateProjectProfit=0
				  this.statementForm.estimateProjectProfit=Number(this.statementForm.payAmount)-Number(this.statementForm.totalDeductibleExpenses) - Number(this.statementForm.totalLogisticsExpenses) -Number(this.statementForm.totalMaintenanceCost)-Number(this.statementForm.taxAmount)-Number(this.statementForm.totalProjectEngineerCost)
				  this.statementForm.estimateProjectProfit=this.getmathtwo(this.statementForm.estimateProjectProfit)
				  // 合伙人分成金额=项目毛利X合伙人分成比列
				  this.statementForm.partnerAmount=0
				  this.statementForm.partnerAmount=Number(this.statementForm.estimateProjectProfit)*parseFloat(this.statementForm.partnerRatio)*0.01
				  this.statementForm.partnerAmount=this.getmathtwo(this.statementForm.partnerAmount)
				  // 项目剩余毛利
				  this.statementForm.residualProjectProfit=0
				  this.statementForm.residualProjectProfit=Number(this.statementForm.estimateProjectProfit)-Number(this.statementForm.partnerAmount)
				  this.statementForm.residualProjectProfit=this.getmathtwo(this.statementForm.residualProjectProfit)
				  // 业务员提成金额=项目剩余毛利*提成比列
				  this.statementForm.salesmanAmount=0
				  this.statementForm.salesmanAmount=Number(this.statementForm.residualProjectProfit)*parseFloat(this.statementForm.salesmanRatio)*0.01
				  this.statementForm.salesmanAmount=this.getmathtwo(this.statementForm.salesmanAmount)			
				  							 
				 })
			 },
             //删除明细
             async delHandFn(index, val) {
                 
                 if (val === 1) {

                     this.statementForm.otherExpensesList.splice(index, 1)
                     this.statementForm.totalOtherExpenses = 0
                     this.statementForm.otherExpensesList.forEach(item => {
                         this.statementForm.totalOtherExpenses += Number(item.totalAmount)

                     })
                 }
                 if (val === 2) {

                     this.statementForm.deductibleExpensesList.splice(index, 1)
                     this.statementForm.totalDeductibleExpenses = 0
                     this.statementForm.deductibleExpensesList.forEach(item => {
                         this.statementForm.totalDeductibleExpenses += Number(item.amount)
                     })
                 }
                 if (val === 3) {

                     this.statementForm.logisticsExpensesList.splice(index, 1)
                     this.statementForm.totalLogisticsExpenses = 0
                     this.statementForm.logisticsExpensesList.forEach(item => {
                         this.statementForm.totalLogisticsExpenses += Number(item.amount)
                     })
                 }
                 if (val === 4) {

                     this.statementForm.maintenanceCostList.splice(index, 1)
                     this.statementForm.totalMaintenanceCost = 0
                     this.statementForm.maintenanceCostList.forEach(item => {
                         this.statementForm.totalMaintenanceCost += Number(item.totalAmount)
                     })
					 if(val===5){
						 this.statementForm.projectEngineerCostList.splice(index,1)
						 this.statementForm.totalProjectEngineerCost=0
						 this.statementForm.projectEngineerCostList.forEach(item=>{
							 this.statementForm.totalProjectEngineerCost+=Number(item.totalAmount)
						 })
						 
					 }
                 }
                 this.$nextTick(function() {
                     // 应收租金
                    // 应该收租金
                    this.statementForm.payAmount = 0
                    this.statementForm.payAmount += Number(this.totalMachineExpense) + Number(this.statementForm.totalOtherExpenses)-Number(this.statementForm.rentAllowanceAmount)
                    	// 应退押金=已收押金-应收合计
                    this.statementForm.refundableDeposit=0
                    this.statementForm.refundableDeposit=Number(this.statementForm.depositPaid)-Number(this.statementForm.payAmount)
                    	console.log(this.statementForm.refundableDeposit,'ui');
                    	// 未收金额=应收合计-已收押金
                    this.statementForm.uncollected=0
                    this.statementForm.uncollected=Number(this.statementForm.payAmount)-Number(this.statementForm.depositPaid)
                  // 税费=应收合计X税率
                  this.statementForm.taxAmount=0
                  this.statementForm.taxAmount=Number(this.statementForm.payAmount)*parseFloat(this.statementForm.taxRatio)*0.01
                  this.statementForm.taxAmount=this.getmathtwo(this.statementForm.taxAmount)
                  // 项目毛利=应收合计-项目应扣费用-物流辅料费用-维修配件费用-税费
                  this.statementForm.estimateProjectProfit=0
                  this.statementForm.estimateProjectProfit=Number(this.statementForm.payAmount)-Number(this.statementForm.totalDeductibleExpenses) - Number(this.statementForm.totalLogisticsExpenses) -Number(this.statementForm.totalMaintenanceCost)-Number(this.statementForm.taxAmount)-Number(this.statementForm.totalProjectEngineerCost)
                  this.statementForm.estimateProjectProfit=this.getmathtwo(this.statementForm.estimateProjectProfit)
                  // 合伙人分成金额=项目毛利X合伙人分成比列
                  this.statementForm.partnerAmount=0
                  this.statementForm.partnerAmount=Number(this.statementForm.estimateProjectProfit)*parseFloat(this.statementForm.partnerRatio)*0.01
                  this.statementForm.partnerAmount=this.getmathtwo(this.statementForm.partnerAmount)
                  // 项目剩余毛利
                  this.statementForm.residualProjectProfit=0
                  this.statementForm.residualProjectProfit=Number(this.statementForm.estimateProjectProfit)-Number(this.statementForm.partnerAmount)
                  this.statementForm.residualProjectProfit=this.getmathtwo(this.statementForm.residualProjectProfit)
                  // 业务员提成金额=项目剩余毛利*提成比列
                  this.statementForm.salesmanAmount=0
                  this.statementForm.salesmanAmount=Number(this.statementForm.residualProjectProfit)*parseFloat(this.statementForm.salesmanRatio)*0.01
                  this.statementForm.salesmanAmount=this.getmathtwo(this.statementForm.salesmanAmount)			
                  							 
                 })
             },
			 // 租金折让
			 rentMoneyFn(){
				 
				 console.log(this.statementForm.rentAllowanceAmount);
				 this.statementForm.payAmount = 0
				 this.statementForm.payAmount += Number(this.totalMachineExpense) + Number(this
				         .statementForm.totalOtherExpenses)-Number(this.statementForm.rentAllowanceAmount)
				 	// 应退押金=已收押金-应收合计
				 	this.statementForm.refundableDeposit=0
				 	this.statementForm.refundableDeposit=Number(this.statementForm.depositPaid)-Number(this.statementForm.payAmount)
				 	console.log(this.statementForm.refundableDeposit,'ui');
				 	// 未收金额=应收合计-已收押金
				 		this.statementForm.uncollected=0
				 		this.statementForm.uncollected=Number(this.statementForm.payAmount)-Number(this.statementForm.depositPaid)
				// 税费=应收合计X税率
				this.statementForm.taxAmount=0
				this.statementForm.taxAmount=Number(this.statementForm.payAmount)*parseFloat(this.statementForm.taxRatio)*0.01
				this.statementForm.taxAmount=this.getmathtwo(this.statementForm.taxAmount)
				// 项目毛利=应收合计-项目应扣费用-物流辅料费用-维修配件费用-税费
				this.statementForm.estimateProjectProfit=0
				this.statementForm.estimateProjectProfit=Number(this.statementForm.payAmount)-Number(this.statementForm.totalDeductibleExpenses) - Number(this.statementForm.totalLogisticsExpenses) -Number(this.statementForm.totalMaintenanceCost)-Number(this.statementForm.taxAmount)-Number(this.statementForm.totalProjectEngineerCost)
				this.statementForm.estimateProjectProfit=this.getmathtwo(this.statementForm.estimateProjectProfit)
				// 合伙人分成金额=项目毛利X合伙人分成比列
				this.statementForm.partnerAmount=0
				this.statementForm.partnerAmount=Number(this.statementForm.estimateProjectProfit)*parseFloat(this.statementForm.partnerRatio)*0.01
				this.statementForm.partnerAmount=this.getmathtwo(this.statementForm.partnerAmount)
				// 项目剩余毛利
				this.statementForm.residualProjectProfit=0
				this.statementForm.residualProjectProfit=Number(this.statementForm.estimateProjectProfit)-Number(this.statementForm.partnerAmount)
				this.statementForm.residualProjectProfit=this.getmathtwo(this.statementForm.residualProjectProfit)
				// 业务员提成金额=项目剩余毛利*提成比列
				this.statementForm.salesmanAmount=0
				this.statementForm.salesmanAmount=Number(this.statementForm.residualProjectProfit)*parseFloat(this.statementForm.salesmanRatio)*0.01
				this.statementForm.salesmanAmount=this.getmathtwo(this.statementForm.salesmanAmount)			
							
			 },
             //提交对账单
             async statementBtnOk() {
                 this.statementForm.statementExpensesList = this.statementExpensesList
                 if (this.statementForm.id) {
                     // 修改对账单
                     console.log('33');
                     await editStatementApi(this.statementForm)
					 var that=this
                     this.$refs.uToast.show({
                         type: 'success',
                         message: '修改成功',
						 complete(){
							 
						 }
                     })
                 } else {
                     await addStatementApi(this.statementForm)
                     this.$refs.uToast.show({
                         type: 'success',
                         message: '新增对账单成功'
                     })
                 }
             },

             //生成出库订单编号
             setOrderNo() {
                 var date = new Date();
                 var year = date.getFullYear(); //年 ,从 Date 对象以四位数字返回年份
                 var month = date.getMonth() + 1; //月 ,从 Date 对象返回月份 (0 ~ 11) ,date.getMonth()比实际月份少 1 个月
                 var day = date.getDate(); //日 ,从 Date 对象返回一个月中的某一天 (1 ~ 31)
                 //修改月份格式
                 if (month >= 1 && month <= 9) {
                     month = "0" + month;
                 }
                 //修改日期格式
                 if (day >= 0 && day <= 9) {
                     day = "0" + day;
                 }

                 let round = Math.floor(Math.random() * (999 - 100)) + 100;
                 var currentFormatDate = `${year}${month}${day}`;
                 return "CKDD" + currentFormatDate + round;
             },
             //生成出库订单编号
             setBackOrderNo() {
                 var date = new Date();
                 var year = date.getFullYear(); //年 ,从 Date 对象以四位数字返回年份
                 var month = date.getMonth() + 1; //月 ,从 Date 对象返回月份 (0 ~ 11) ,date.getMonth()比实际月份少 1 个月
                 var day = date.getDate(); //日 ,从 Date 对象返回一个月中的某一天 (1 ~ 31)
                 //修改月份格式
                 if (month >= 1 && month <= 9) {
                     month = "0" + month;
                 }
                 //修改日期格式
                 if (day >= 0 && day <= 9) {
                     day = "0" + day;
                 }

                 let round = Math.floor(Math.random() * (999 - 100)) + 100;
                 var currentFormatDate = `${year}${month}${day}`;
                 return "HKSQ" + currentFormatDate + round;
             },


         }
     }
 </script>

 <style lang="scss">
	 .right-list{
	 	position: relative;
	 	margin: 5px;
	 	padding: 5px;
	 	border: solid 1px #c3c3c3;
	 	font-size: 12px;
	 	.button{
	 		position: absolute;
	 		right: 10px;
	 		bottom: 10px;
	 	}
	 }
     .form {
         background-color: #fff;
         padding-left: 10px;
         padding-right: 10px;

         .box {
             height: 200px;

             .boxTop {
                 width: 100%;
                 height: 30px;
                 display: flex;
                 justify-content: space-between;
             }

             .boxValue {
                 width: 100%;
                 display: flex;
                 justify-content: space-between;
             }
         }

     }

     .orderdetails {
         background-color: #fff;

         .details {
             padding: 10px;
             border-bottom: solid 1px #eee;
         }

         .u-slot-title {
             display: flex;
             justify-content: space-between;

         }
     }

     .list-header {
         display: flex;
         justify-content: space-between;

         span {
             color: #ff7c35;
         }

     }

     .list-information {
         font-size: 13px;
         margin-right: 20px;

         view {
             padding: 3px 0;

             span {
                 margin-left: 10px;
             }
         }
     }

     .list-name {
         display: flex;
         justify-content: space-between;
         height: 40px;
         line-height: 40px;
         font-size: 13px;
         padding: 0 10px;
     }

     .demo-uni-row {
         font-size: 13px;
         height: 40px;
         line-height: 40px;
         padding: 0 10px;
     }

     .grid-item-box {
         width: 100px;
         height: 100px;
         margin: 0px 10px 0;
         padding-top: 30px;
         border: solid 1px #eee;
         background-color: rgba(235, 228, 228, 0.3);
         border-radius: 10px;
         box-shadow: 4px 4px 15px #eee;

         .text {
             display: block;
             text-align: center;
         }
     }

     .u-cell-text {
         font-size: 14px;
     }

     // 关联产品
     .productList-box {
         padding: 10px;
     }

     // 项目支出新增按钮
     .addBtn {
         width: 42px;
         min-height: 22px;
         line-height: 22px;
         background-color: #49b2f1;
         color: #fff;
         font-size: 12px;
         text-align: center;
         border-radius: 5px;

     }

     // 新增费用  按钮
     .pop-box {
         min-width: 300px;
         min-height: 200px;
         padding: 20px;
         position: relative;

         .title {
             padding-top: 5px;
             margin-right: 5px;

         }

         .button {
             width: 100px;
             display: flex;
             position: absolute;
             right: 40px;
             bottom: 20px;

         }


     }

     .Box {
         .little-box {
             padding: 10px;
             border-bottom: solid 1px #c3c3c3;

             .title {
                 font-size: 16px;
                 margin-bottom: 5px;
             }
         }

     }

     .btn {
         width: 100%;
         min-height: 40px;
         line-height: 40px;
         // margin-top: 25px;
         border: solid 1px #c3c3c3;
         display: flex;
         justify-content: space-evenly;
     }
 </style>
